NYCPHP Meetup

[nycphp-talk] image display

selyah selyah1 at yahoo.com
Sun Aug 26 18:15:06 EDT 2007


could someone please look at this code and please tell me what is wrong.
 it is suppose to display a 4 column table with an indiffenate number of rows.
 Instead it displays one image in row , then 3 images in row 2.  Then one image in row 3 and e images in row 4, and so on.  thanks.  Here is the code:
 
 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);
 $col = 0;
 echo '<table border="0" width="90%" cellspacing="3" cellpadding="3" align="center">';
 
 if($num>0) {
 while($row=mysql_fetch_array($result)) {
 if($col == 0)
 echo '<tr>';
 
 
 echo '<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>';
 
 if($col == 0)
 
 echo '</tr>';
 
 $col++;
 $col = ($col == 4) ? 0 : $col;
 }
 }
 echo '</table>';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070826/31ed9266/attachment.html>


More information about the talk mailing list