Hey all,
This is my first post and I am fairly new to php. I am trying to display images from the database by category in a grid fashion (3 across a table row and multiple rows until ni more products left to show).
I have manage to get the products to display by category on the page but only one per row so far. Any help getting them 3 or 4 per row would be utterly grateful. Code is below:
<?
$strSQL = "SELECT * FROM products WHERE category = 'Plant Hire'";
if ($result = mysql_query($strSQL) or die ("Invalid query")) {
$num = mysql_num_rows($result);
<?
}
}
?>
for($i=0;$i<$num;$i++){
?>
<tr>
<td>
<a href="productspage.php?id=<?=mysql_result($result,$i,"id")?>&/<?=preg_replace('/[^\da-zA-Z\_\-\.]/', '', str_replace(" ", "_", mysql_result($result,$i,"title")))?>"><img width="150" style="border:none" src="images/products/<?=mysql_result($result,$i,"ID")?>.jpg" hspace="10"><br />
<?=mysql_result($result,$i,"title")?>
<?
}
}
?>