Rumah  >  Artikel  >  pembangunan bahagian belakang  >  Warning: mysql_fetch_assoc() expects parameter 一 to be resource

Warning: mysql_fetch_assoc() expects parameter 一 to be resource

WBOY
WBOYasal
2016-06-13 12:17:071140semak imbas

Warning: mysql_fetch_assoc() expects parameter 1 to be resource,
Warning: mysql_fetch_assoc() expects parameter 1 to be resource,报错

<br />function UpdateDeliveryNumber($number){<br />    <br />    $sql=new MYSQL();<br />    $n_qz=$number.date("md");<br />	$head=str_pad($n_qz,12,0);<br />    <br />       $sqlstr="SELECT group_concat(`order_id`) FROM `Sale_Order` “;<br />       $sqlstr.="WHERE `number`=$number GROUP BY `recipient_name`,`ship_address`,`delivery_area`"; <br />       $sqlstr.="ORDER BY length(group_concat(`order_id`)) DESC  ";<br />	$query=$sql->query($sqlstr);<br />    echo $sqlstr."<br>";<br />    echo $sql->num_rows($query)."<br>";<br />    if($sql->num_rows($query)){//判断是否查询到记录<br />	 while($rs=$sql->fetch_array($query)){<br />	 echo "select OK";<br />	$sql_item="UPDATE `Sale_Order` SET `delivery_number`='$head' WHERE `order_id`='' ";<br />	$order_item_id=explode(",",$rs["group_concat(`order_id`)"]);<br />        echo $rs["group_concat(`order_id`)"]."<br>";<br />	foreach($order_item_id as $n)<br />		{<br />			$sql_item.=" OR `order_id`='$n'  ";<br />		}<br />        echo $head."<br>";<br />	$head++;<br />        echo $sql_item."<br>";<br />        $query_item=$sql->query($sql_item);<br />	echo $query_item;<br />    	}<br />        }<br />    }<br /><br />UpdateDeliveryNumber(21);<br />echo "OK";<br /><br />


<br />SELECT group_concat(`order_id`) FROM `Sale_Order` WHERE `number`=21 GROUP BY `recipient_name`,`ship_address`,`delivery_area` ORDER BY length(group_concat(`order_id`)) DESC<br />2<br />select OK114-4278868-5227463<br />210323000000<br />UPDATE `Sale_Order` SET `delivery_number`='210323000000' WHERE `order_id`='' OR `order_id`='114-4278868-5227463'<br />Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /var/www/html/demo/class/mysql.class.php on line 53 OK<br />


请问哪里有问题啊,语句都拿去phpmyadmin执行过了,都是正常的

------解决思路----------------------
你的 MYSQL 类封装的有问题
------解决思路----------------------
把你的类贴出来以供分析

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn