[nycphp-talk] table image display
selyah
selyah1 at yahoo.com
Tue Aug 21 00:40:38 EDT 2007
Php Version: 4.3.10
mysql version: 4.19
I need assistance in displaying images from a database into a table.
The script is successfully getting the image from the database in placing them int he table that i created. The problem is, each row is repeating the same image, ie, item one is shown in column 1, column 2, column3 , and column 4 in row 1. The item 2 is shown in column 1, column 2, column3 , and column 4 in row 2, and so on. I am at a lost on how to display the images so that each item is displayed in consectively rows and columns as needed without repeating themselves. I will copy the script below.
If any one can see my error, i would appriciate the input. Thanks:
<?php #catalog.php - display all catalog items
include('includes/header.php');
require_once('connect/mysql_connect.php');
$query="SELECT item_id, modelnum, name, upload, size, description, price, gender FROM clothing ORDER BY item_id ASC";
$result=@mysql_query($query);
$num=@mysql_num_rows($result);
if($num>0) {
while($row=mysql_fetch_array($result))
echo '
<table border="0" width="90%" cellspacing="3" cellpadding="3" align="center">
<tr>
<td align="center" width="20%"><font color="teal">cAclOm'.$row['modelnum'].'</font>
<span style="padding-left:5%">'.$row['name'].'</span><br /><br />
<img src="/coles/admin/new_images/'.$row['upload'].'" width="120" height="140" /><br />
'.$row['description'].'<span style="padding-left:5%">'.$row['price'].'</span>
</td>
<td align="center" width="20%"><font color="teal">cAclOm'.$row['modelnum'].'</font>
<span style="padding-left:5%">'.$row['name'].'</span><br /><br />
<img src="/coles/admin/new_images/'.$row['upload'].'" width="120" height="140" /><br />
'.$row['description'].'<span style="padding-left:5%">'.$row['price'].'</span>
</td>
<td align="center" width="20%"><font color="teal">cAclOm'.$row['modelnum'].'</font>
<span style="padding-left:5%">'.$row['name'].'</span><br /><br />
<img src="/coles/admin/new_images/'.$row['upload'].'" width="120" height="140" /><br />
'.$row['description'].'<span style="padding-left:5%">'.$row['price'].'</span>
</td>
<td align="center" width="20%"><font color="teal">cAclOm'.$row['modelnum'].'</font>
<span style="padding-left:5%">'.$row['name'].'</span><br /><br />
<img src="/coles/admin/new_images/'.$row['upload'].'" width="120" height="140" /><br />
'.$row['description'].'<span style="padding-left:5%">'.$row['price'].'</span>
</td>
</tr>';
}
echo '</table>';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070820/45274fe1/attachment.html>
More information about the talk
mailing list