I am trying to Array results from a MYSQL database into a html table, however when i do this, it seems to be showing one item per row (1 column)
here is my code
<?php
$catagory=$_GET["q"];
$con = mysql_connect("localhost","cl49-XXX","XXX");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("cl49-XXX", $con)or die( "Unable to select database");
$result=mysql_query("SELECT * FROM products WHERE catagory = '$catagory' ")or die('You need enter a catagoryE ' );
while($row = mysql_fetch_array($result)) {
$prodname=$row['prodname'];
$prodID=$row['prodID'];
echo"
<table>
<tr>
<td>
<b>$prodname </b><br>
Product ID: $prodID<br />
<img src='userpics/$prodID.jpg' height='200' width='200'></td></table> ";
}
?>
I am wanting a table with 3 columns, not 1?
<table>
for each record, then you're going to get a new table for each record. – deceze Aug 2 '13 at 10:01<table>
and<td>
for each record... – deceze Aug 2 '13 at 10:13