Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Image arrangement

images php coding issues or problems here.

Moderators: macek, egami, gesf

Postby Flood » 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
Flood
New php-forum User
New php-forum User
 
Posts: 23
Joined: Tue Jun 24, 2003 4:49 am

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron