Re: mysql table layout help needed
| From: | Chris Payne | Date: | Sat, 22 Dec 2001 06:25:47 +0000 |
| Subject: | Re: mysql table layout help needed | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15191@lists.php.net to get a copy of this message | ||
Hi there,
I format my results using the following code:
<?
// format results by row
while ($row = mysql_fetch_array($sql_result)) {
$title = $row["title"];
$desc = $row["description"];
$image = $row["image"];
$url = "index3.php?image=".($row["image"]);
?>
<a href="<?=$url?>&<?="$PHPSESSID"?>"><img
src="images/<?=$image?>.jpg"
align = "center" width="150" height="100" hspace="15"
border="0"><br>
<?=$title?><br>
</a><br>
</font>
<?
}
// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);
?>
I prefer to use this method rather than echo's as it's easier to follow (I
don't know about any downsides though, I just know it's easier for me to
program this way).
I tried the code that you gave (Bogdan, thank you) but still being fairly
fresh to PHP I couldn't get it to work. I need it to display 3 across and
however many down in a table, but can't for the life of me get it to work
the images just display ontop of each other or all on one line - wish I
could use programmers logic but i'm not a very logical person.
Any help would be very appreciated - something which fit in with the kind of
code I use above would be a GODSEND.
Thanks again and happy holidays :-)
Regards
Chris