[thelist] php/mysql output to browser questions...

John Corry webshot at neoncowboy.com
Fri Mar 30 10:36:47 CST 2001


I'm workign on an app that will generate the content in this page:
http://www.simmerhawaii.com/hookipa
from a database, with PHP.

I have a couple of questions that some of you may be able to answer...

1) The thumbnail images are all in the first column. So, the output is going
to go sort of like this:
	a) open the table
	b) create the first row and cell with thumbnail #1 (from the returned array
of thumbnails) in it.
	C) determine the number of thumbnails returned and set the next cell's
rowspan attribute accordingly
	d) write the text into the 2nd cell
	e) create the 3rd cell, with the table of links (I'm ignoring this for now
while I solve other problems)
	f) finish up by putting the rest of the thumbnails on subsequent rows.

So, how can I get that first image separated out from the rest of the images
in the array? Right now, all I've done is to use a 'while' statement to
return all of the image paths...I need to get the first image, then do the
text, then do the rest of the images. How?

2) I'm having some problems with character escaping: My text content is in
an Excel file, which I have saved as a .csv. I am using PHPMyAdmin to put
the .csv into the table. Trouble is, when I write the contents into the
page...all of the ' & " are escaped with \'s. I want those literal
characters.

GRRRR...I'm trying everything and it isn't quite working...
When I select the 'fields enclosed by' option with " and check 'optionally',
I get all of the text in the largest content field written into the page
without being enclosed in ", but all ' & " are escaped...not literal. Am I
going to have to use some weird PHP string manipulation to get what I want?
Or is there a way to just store the literal values and retrieve the literal
values?

I was suspicious of Excel, but when I open the .csv in a text editor, the
literal characters are unescaped...so I think it's MySQL lending a hand.

Even when I select that fields are escaped by nothing, my ' get replaced
with \'.

Hope somebody can lend a hand with this...I'm dying here!

<tip type="php">
I am successfully using the function GetImageSize(), but have a tip. URL
support is only as recent as PHP 4.05. That means you can't use this
function when calling images from root ('/images/my/image.gif'). So, I had
to create a variable with a relative path to the image to get the function
to work.
</tip>

Thanks,
John Corry





More information about the thelist mailing list