PHP loop position

Posted by Jordan Pagaduan on Stack Overflow See other posts from Stack Overflow or by Jordan Pagaduan
Published on 2010-04-16T20:43:45Z Indexed on 2010/04/16 20:53 UTC
Read the original article Hit count: 170

Filed under:

Can someone help me on this. I'm made an image uploader and i want the image to make another tr if it reach to 5 pics so it will not overflow. Here is my code: Can someone help me on this. I'm made an image uploader and i want the image to make another tr if it reach to 5 pics so it will not overflow. Here is my code:

$dbc = mysql_connect("localhost" , "root" , "") or die (mysql_error());
mysql_select_db('blog_data') or die (mysql_error());

$sql = "SELECT * FROM img_uploaded";
$result = mysql_query($sql);
while($rows=mysql_fetch_array($result))
{
  if ($rows)
  {
    echo "<tr><td><img src='user_images/".$rows['img_name'] . "' width='100' height='100'></td></tr>";
  }
  else
  {
    echo "<td><img src='user_images/".$rows['img_name'] . "' width='100' height='100'></td>";
  }
}

© Stack Overflow or respective owner

Related posts about php