bee80
08-11-2009, 04:28 PM
Im building a dynamic photo gallery with pagination and am looking for help or a tutorial on populating a table with say 20 photos per page(similar to an amazon results page)im cool(for now) with the pagination part but cant find any info on dynamically populating a table. Im looking for something like 4 columns down 5 rows across at the moment its just 20 vertical images :(
Here is the test code thats producing the 1 column 20 row table:
<?php
$query= "SELECT * FROM photos WHERE user_id = '$id'";
$result= mysql_query($query)or die('couldnt query');
$table = "<table width=\"10%\" border=\"1\">";
while($row = mysql_fetch_array($result)){
$table .= " <tr>
<td><img src=photos/sml_".$row[image].'> </td></tr><br />';
}
$table .= "</table>";
echo $table;
?>
now how do i make it go :
pic pic pic pic pic
pic pic pic pic pic
pic pic pic pic pic
any ideas would be great :)
Here is the test code thats producing the 1 column 20 row table:
<?php
$query= "SELECT * FROM photos WHERE user_id = '$id'";
$result= mysql_query($query)or die('couldnt query');
$table = "<table width=\"10%\" border=\"1\">";
while($row = mysql_fetch_array($result)){
$table .= " <tr>
<td><img src=photos/sml_".$row[image].'> </td></tr><br />';
}
$table .= "</table>";
echo $table;
?>
now how do i make it go :
pic pic pic pic pic
pic pic pic pic pic
pic pic pic pic pic
any ideas would be great :)