Forum Moderators: coopster
In this case, I'd set up an array $pics and in your foreach loop, just add the result as an element to the array. Then I'd do one of the two:
a) just echo out the table or other html with all 9 pictures in the same place (do this if b looks too difficult)
b) set up a 'while' loop or some other kind that will repeat three times, set up a counter starting at zero, echo out each picture w/ html as $pics[$counter] $pics[($counter + 1)] $pics[($counter + 2)] (appropriate HTML in between - look up 'tables' in an html tutorial if you have no idea how to do this), and then increment the counter by three - $counter = $counter + 3;
my idea is something like this:
print "<table border=1>";
while ($qry = mysql_fetch_array($result)) {
print "<tr>";
$counter = 0;
if ($counter < 4){
print "<td>";
print "<IMG SRC=\"$qry[picture]>";
print "</td>";
$counter = $counter + 1;
print "</td>";
}
print "</tr>";
}
print "</table>";
but it seems not work as i expected.
Try this; it isn't tested. Have fun. Thx for posting a little code, makes me feel I'm not doing all your homework!