$query1="select b.wareid from u_ware_class a,u_store_m b where a.classcode ='01190202' and a.wareid=b.wareid and b.busno=1001 and b.sumqty>0";
$stmt1 = $PDO-> query ( $query1 );
while ($row = $stmt1->fetch(PDO::FETCH_ASSOC))
{
extract($row);
echo "{$wareid}
";
}
现在输出的是一条一条的。想要输出总共多少条。做个统计
直接查询select count(1)的记录条数。
或者用一个变量统计while 执行的次数。
改sql语句统计 select count(1) from u_ware_class a,u_store_m b where a.classcode ='01190202' and a.wareid=b.wareid and b.busno=1001 and b.sumqty>0
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!