Hello, I am trying to get the results from a mysql database and display them into a table. I will have many rows, but I only want 3 columns. I want each row of the table to display as such:
Column 1 Column 2 Column 3
Result 1 Result 2 Result 3
Result 4 Result 5 Result 6
Result 7 Result 8 Result 9
The problem is, the code I have does not do this, here is my code below, please help me do what I have asked above, please?
<table id="pr" width="100%" border="1" cellspacing="0" cellpadding="0">
<?php
$result = mysql_query("SELECT * FROM products ")
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$productNo = $row['productNo'];
$productCode = $row['productCode'];
$name = $row['name'];
$desc = $row['desc'];
$image = $row['image'];
?>
<tr>
<td align="center" valign="top">
Product No: <?php echo $productNo; ?><br />
<?php echo $productNo; ?><br />
<img src="images/merch/<?php echo $image; ?>" width="216" height="170" /><br />
<?php echo $desc; ?>
</td>
<td align="center" valign="top">
Product No: <?php echo $productNo; ?><br />
<?php echo $productNo; ?><br />
<img src="images/merch/<?php echo $image; ?>" width="216" height="170" /><br />
<?php echo $desc; ?>
</td>
<td align="center" valign="top">
Product No: <?php echo $productNo; ?><br />
<?php echo $productNo; ?><br />
<img src="images/merch/<?php echo $image; ?>" width="216" height="170" /><br />
<?php echo $desc; ?>
</td>
</tr>
<?php
}
?>
</table>
Thanks!