现在我需要展示产品的图片,它以 id 号命名。不像这样工作:
$cat_list .= "Product ID: $id - <strong>$product_name</strong> - <img src=inventory_images/'$id'.jpg"> <br />";
我该怎么做!??!它不是那样工作的,整个代码是这样的:
<?php
$cat_list="";
$cat=$_GET['cat'];
$cat_sql="SELECT * FROM products,prod_cat,categories WHERE categories.id=prod_cat.cat_id AND products.id=prod_cat.prod_id AND categories.id=$cat";
$cat_query=mysql_query($cat_sql) or die(mysql_error());
$productCount = mysql_num_rows($cat_query); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($cat_query)){
$id = $row["id"];
$product_name = $row["product_name"];
$cat_list .= "Product ID: $id - <strong>$product_name</strong> - <br />";
}
}
?>