当前位置:Gxlcms > PHP教程 > Warning:mysql_fetch_assoc()expectsparameter一toberesource

Warning:mysql_fetch_assoc()expectsparameter一toberesource

时间:2021-07-01 10:21:17 帮助过:10人阅读

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


function UpdateDeliveryNumber($number){

$sql=new MYSQL();
$n_qz=$number.date("md");
$head=str_pad($n_qz,12,0);

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

UpdateDeliveryNumber(21);
echo "OK";




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
2
select OK114-4278868-5227463
210323000000
UPDATE `Sale_Order` SET `delivery_number`='210323000000' WHERE `order_id`='' OR `order_id`='114-4278868-5227463'
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


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

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

人气教程排行