我已经在opencart中创建了一个webstore。我为卖家添加了一些额外的页面来注册和销售他们的产品。当卖家添加产品时,它返回:警告:mysql_fetch_assoc()期望参数1是资源,布尔在第45行给出的/home/content/30/10933330/html/sales/save_item.php
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
并且产品未添加到主页面。
我的代码是:
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>';
}
?>
请帮助
哪一行是“第45行”? – Helpful