Jump to content

[SOLVED] Insert </tr><tr> every 4 loops. With pictures.


maGGot_H

Recommended Posts

I can't believe i stucked on such thing.

There is an uncertain number of pictures that need to be displayed reverse (new ones before old ones) 4 in a row.

And after every 4 loops the script must insert </tr><tr> until the loop come to an end (0).

I decided to move this way:

  
$rows=mysql_num_rows($cmd_rows); // THAT NUMBER OF PICTURES
  echo '<table><tr>';
   for ($view=$rows-1;$view>=0;$view--) {
   if ($view%4==0) { echo '</tr><tr>';}
  echo '
<td>//PIECE OF CODE //</td>
';
      }
echo '</tr></table>';

 

But i've met that if the number of pictures splits on 4 at once (before there are 4 loop circles), the script insert the </tr><tr> at the start of the page as i told him.

How can i reslove this problem? TO have 4 pictures in a row independently of the number of pictures.

Pardon me if you notice any mistakes in my English =).

 

Images included:

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.