I have created a webstore in opencart. I added some extra pages for sellers to register and sell their products in it. When seller add a product it returns :
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/content/30/10933330/html/sales/save_item.php on line 45
and the product is not added to the main page.
My code is:
mysql_query("insert into oc_product (model,seller_id,quantity,price,image,status,listing_days) values ('$model','".$_SESSION['seller_id']."','$qnt','$price','data/no_image.jpg','1','$datetime')");
mysql_query("insert into seller_balance (seller_id,amount,remark) values('".$_SESSION['seller_id']."','$amount','$remark')");
$product_id=mysql_query("select product_id from oc_product where seller_id='".$_SESSION['seller_id']."' order by product_id desc");
$product_fetch=mysql_fetch_assoc($product_id);
$product_id_result=$product_fetch['product_id'];
mysql_query("insert into oc_product_description (product_id,language_id,name,description) values ('$product_id_result','1','$name','$description')");
mysql_query("insert into oc_product_to_category (product_id,category_id) values('$product_id_result','$category')");
mysql_query("insert into oc_product_to_store (product_id,store_id) values('$product_id_result','0')");
echo'
<div id="div_after_save" style="float:left;">
<br/>
<br/>
<small><strong style="color:#000; font-size:12px;">Upload Image<br/>
<form action="send_hp.php" id="hp_form" method="POST" enctype="multipart/form-data">
<input type="file" name="h_pic" id="hp_upload" style="color:#000;" required="required" />
<input type="hidden" name="product_id" id="product_id" value="'.$product_id_result.'"/>
</form></strong></small>';
echo'<div id="image_div" style="width:300px; height:150px;">
</div>';
}
?>
pls help