php – mysql_fetch_array()问题
发布时间:2020-12-13 17:07:10 所属栏目:PHP教程 来源:网络整理
导读:以下是抛出以下错误: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/zyquo/public_html/ghosthuntersportal.com/product_process.php on line 33 Line 33 is: while($row11=mysql_fetch_array($result11
以下是抛出以下错误:
Line 33 is: while($row11=mysql_fetch_array($result11)){ elseif($_GET['do']=="add"){ $sql10="INSERT INTO $tbl_name (product_name,product_price,product_category,product_link,product_image,product_tag,product_features,product_pros,product_cons,product_description,product_notes) VALUES ('$product_name','$product_price','$product_category','$product_link','$product_image','$product_tag','$product_features','$product_pros','$product_cons','$product_description','$product_notes')"; mysql_query($sql10); $sql11="SELECT product_id FROM $tbl_name WHERE product_name=".$product_name.""; $result11=mysql_query($sql11); while($row11=mysql_fetch_array($result11)){ $product_id2=$row11['product_id']; $sql12="INSERT INTO $tbl_name2 (keyword,product_id) VALUES ('$keyword','$product_id2')"; mysql_query($sql12); } } 查询sql10运行并插入数据,查询sql11不运行. 解决方法
您必须尝试使用??“.$product_name”的单引号.
$sql11 = "SELECT product_id FROM $tbl_name WHERE product_name='" . $product_name . "' "; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |