Image arrangement

images php coding issues or problems here.

Moderators: egami, macek, gesf

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

Sat Jun 28, 2003 2:18 pm

Hi!

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

<table>
<?php
  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>";
     }
  }
?>
</table>


Does it fulfill your expectations?

/Flood

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest