what am i’m trying to do !
i want get products from mysql database and display in multiple columns, side by side and be able to create a link to the product id!i have managed to do this nested loop but its not printing the image and i cant find a way to do think link and get the image !any help could be greatly apprecieated
below is the code !!
<?php
mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
mysql_select_db("$db_name") or die ("no database");
$query="select * from product";
$result=mysql_query($query);
$cols=4;
echo "
";
do{
echo "";
for($i=1;$i<=$cols;$i++){
$row=mysql_fetch_array($result);
if($row){
$img = $row['images/'];
?>
<td>
<table>
<tr valign="top">
<td><img src="images/<?=$img ?>" /></td>
<td>
<b><?=$row[''] ?></b><br />
<?=$row['prod_category'] ?><br />
<?=$row['price'] ?><br />
<?=$row['description'] ?><br />
</td>
<td width="50"> </td> <!-- Create gap between columns -->
</tr>
</table>
</td>
<?
}
else{
echo " | ";
}
}
} while($row);
echo "
";
?>