Tuesday, 15 February 2011

mysql - display picture with php -



mysql - display picture with php -

now need show image of product, named id number. doesnt work this:

$cat_list .= "product id: $id - <strong>$product_name</strong> - <img src=inventory_images/'$id'.jpg"> <br />";

how supposed !??! doesnt work that, whole code this:

<?php $cat_list=""; $cat=$_get['cat']; $cat_sql="select * products,prod_cat,categories categories.id=prod_cat.cat_id , products.id=prod_cat.prod_id , categories.id=$cat"; $cat_query=mysql_query($cat_sql) or die(mysql_error()); $productcount = mysql_num_rows($cat_query); // count 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> -&nbsp; &nbsp; &nbsp; <br />"; } } ?>

syntax errors in $cat_list string:

$cat_list .= "product id: $id - <strong>$product_name</strong> - <img src='inventory_images/$id.jpg'> <br />";

php mysql image

No comments:

Post a Comment