maGGot_H Posted November 15, 2007 Share Posted November 15, 2007 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] Link to comment https://forums.phpfreaks.com/topic/77486-solved-insert-every-4-loops-with-pictures/ Share on other sites More sharing options...
pocobueno1388 Posted November 15, 2007 Share Posted November 15, 2007 Take a look at this tutorial http://www.phpfreaks.com/forums/index.php/topic,95426.0.html Link to comment https://forums.phpfreaks.com/topic/77486-solved-insert-every-4-loops-with-pictures/#findComment-392252 Share on other sites More sharing options...
maGGot_H Posted November 15, 2007 Author Share Posted November 15, 2007 What a pitty I didn't reach that! So simple. Apply a little logic and find the answer... Thanks. Link to comment https://forums.phpfreaks.com/topic/77486-solved-insert-every-4-loops-with-pictures/#findComment-392272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.