asuming $res holds your query result:
if($col==0) echo '<tr>';
echo "<td> <img src="$img[thumb]"> </td>";
if($col!=0) str_repeat('<td></td>', 4 - $col);
Wee Keat [Amorphosium] wrote:
I've tried to figure this one out but I'm really having a headache now. So, I really need your help.
I have a database of images and its own thumbnails created using GD. It worked wonderfully.
I want to display ONLY thumbnails in table form, incrementing in rows of 4 columns. By this I mean that I want to write a script which loops in a way that it displays 4 pictures withdrawn from the database into a row, and then for the next 4 images, displays them into the next row.
If you don't understand see the gif below... a script that displays 4 pictures across first ( arrow 1) , then goes to the next row and displays the next 4 ( arrow 2).
I can't work out how can i structure my loop to do this.
Can all the gurus out there please give me a pointer? I really can't work out the logic or systematic flow of scripting this one.
Thank you so much in advance!
Wee Keat Chin
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." - Albert Einstein
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php