So writing my first PHP website with a web store. I have written a piece of code that is suppose to select the products database with all the products of a category, and then display an image using the same product_id
selecting the front picture.
Code is as follows:
<?PHP
include_once "db.php";
$result = "(select * FROM products WHERE product_type = 'weddingdressaline') inner join (select * FROM images WHERE postion = 'front') images on products.product_id = images.product_id";
while($row = mysql_fetch_array($result)) {
$content = $row['image'];
header('Content-type: image/jpg');
echo $content;
echo $row['price'];
}
mysql_free_result($result);
mysql_close();
?>
But when I run the script I get the following errors:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in **/weddingdressaline.php on line 4
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in **/weddingdressaline.php on line 11
Now I'm pretty sure that the reason for the second error is because the first error is occuring. Any help you could give me would be really appreciated.