Heim > Artikel > Backend-Entwicklung > Warning: mysql_fetch_assoc() expects parameter 一 to be resource
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 />