Warning: mysql_fetch_assoc() expects parameter 一 to be resource
程序员文章站
2022-06-01 09:01:40
...
Warning: mysql_fetch_assoc() expects parameter 1 to be resource,
Warning: mysql_fetch_assoc() expects parameter 1 to be resource,报错
请问哪里有问题啊,语句都拿去phpmyadmin执行过了,都是正常的
------解决思路----------------------
你的 MYSQL 类封装的有问题
------解决思路----------------------
把你的类贴出来以供分析
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 类封装的有问题
------解决思路----------------------
把你的类贴出来以供分析
相关文章
相关视频
上一篇: 第十四节--命名空间
下一篇: php串口通信编程问题
推荐阅读
-
php expects parameter 1 to be resource, array given 错误
-
Warning: mysql_fetch_array() expects parameter 1 to be resou_MySQL
-
Warning: mysql_fetch_assoc() expects parameter 1 to be resource
-
参数确实是true,但是仍是有警告mysql_fetch_row() expects parameter 1 to be resource
-
mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:何解?解决办法
-
php提示异常 mysql_fetch_array() expects parameter 1 to be resource, boolean given
-
参数确实是true,但是还是有警告mysql_fetch_row() expects parameter 1 to be resource?
-
php expects parameter 1 to be resource, array given 错误_PHP
-
请问一个异常Warning: rawurlencode() expects parameter 1 to be string, array given
-
mysql_fetch_array() expects parameter 一 to be resource