Image arrangement

images php coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 23
Joined: Tue Jun 24, 2003 4:49 am

Post by Flood » Sat Jun 28, 2003 2:18 pm


I am not sure I have understood your question, but...
Loop over your images, create a new row only when you have reached 5 images (=5 columns) on the current row... It sounds a little bit confusing, but the following code should explain it better:

Code: Select all

  for ($i = 0; $i < mysql_num_rows($sql_results); $i++) {
     if ($i % 5 == 0) {
       print "<tr>";
     print '<td><img src="'.$link_to_image_out_of_sql_query.'" alt="" /></td>';
     if ($i % 5 == 0) {
       print "</tr>";

Does it fulfill your expectations?


Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests