I have a photo gallery and I need help displaying the query results – thumbnail pictures.
Right now when someone selects an album category the thumbnail pictures are displayed down the page one on top of the other. This is rather simple as it’s just:
[CODE]<tr><td><a href=’./bigimage/pic1.jpg’>pic1_th.jpg</a></td></tr>
It produces a new table row for each thumbnail until it reaches the limit set in the query.
Instead, I’d like to have four thumbnails per row and have it make as many rows as necessary to meet the limit per page set in the query. If you’re familiar with Coppermine, it would be like how they have their thumbnails displayed.
I’m not sure how to go about writing the code to do this.
[CODE]$sql = “SELECT * FROM $tbl_name WHERE cat_id=’$cat_id’ ORDER BY id LIMIT $start, $limit”;
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
$id = $row[‘id’];
$cat_id = $row[‘cat_id’];
$imagename = stripslashes($row[‘imagename’]);
echo ”
<tr>
<td><‘./bigpic/$imagename’>$imagename</a></td>
<td><‘./bigpic/$imagename’>$imagename</a></td>
<td><‘./bigpic/$imagename’>$imagename</a></td>
<td><‘./bigpic/$imagename’>$imagename</a></td>
</tr>
“;
}
How do I get it to automatically make a new cell (up to four) and a new row if necessary?
Thanks.
Alan P