我正在尝试将 MYSQL 数据库中的结果排列到 html 表中,但是当我这样做时,它似乎每行显示一个项目(1 列)
这是我的代码
<?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> ";
}
?>
我想要一个有 3 列而不是 1 列的表?