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!
Grid output using php
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
after searching the forums for 10 sec I found
you'll obviously have to modify it for your needs
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++;