asuming $res holds your query result:
$col=0;
echo '';
while($img=mysql_fetch_array($res)) {
if($col==0) echo '';
echo " ";
$col++;
if($col==4) {
echo '';
$col=0;
}
}
if($col!=0) str_repeat('', 4 - $col);
echo '';
Not tested
Wee Keat [Amorphosium] wrote:
Hi all...
I've tried to figure this one out but I'm really having a headache now. So, I really need your help.
Situation:
I have a database of images and its own thumbnails created using GD. It worked wonderfully.
Problem:
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.
Question:
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!
Yours,
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