当我单击类别列表时,我只获得类别 1 信息。但是 mysql_fetch_array 无法获取 2,3,4,5 id 的信息。代码在这里。请帮忙:
类别列表:
$cat=mysql_query("select * from category");
while($row=mysql_fetch_array($cat)){
echo "<li><a href='index.php?cat_id=$row[id]'>$row[name]</a></li>";
}
?>
</div>
<br><br>
<b>Cart</b>
<div class="leftcon">
<?php
mysql_select_db($dbname,$con);
echo "<br>Coming Soon<br><br><br>";
?>
索引页面
if($cat_id==null){
$cat_id = 1;
}
$sql="select * from product where
cat_id = $cat_id";
echo $sql;
$rs=mysql_query($sql,$con);
while($row = mysql_fetch_array($rs)){
echo "<div class='con_product'>";
echo "<b>$row[product_name]</b><br>";
echo "<img src=$row[product_image] height='100' width='128'><br>";
echo "$row[description]<br>";
echo "<div class='con_product_price'><b>BDT $row[unit_price]</b></div>";
echo "</div>";
}
?>