Page 1 of 1

Grid output using php

Posted: Tue Nov 02, 2004 2:08 pm
by zander213
Hello - I am using dreamweaver to design some php pages, and I was wondering how I can create an output of products that are 4 products wide by 4 high (in a grid)...

So far I can make a list of the products vertically, but im not sure about the design for this type of grid layout... Is there a php script that will display the "next" item at a specific location?

Thanks!

Posted: Tue Nov 02, 2004 2:25 pm
by John Cartwright
after searching the forums for 10 sec I found

Code: Select all

$result = mysql_query("SELECT * FROM pics");
$loop=1;

while($row = mysql_fetch_assoc($result)){

if($loop==1){
echo "<tr>";
}

echo "<td><img src="$row[image]"></td>";

if($loop==4){
echo "</tr>";
$loop = 0
}

$loop++;
you'll obviously have to modify it for your needs