1 回答
TA贡献1789条经验 获得超10个赞
不确定为什么你的代码是这样构造的,你可以通过使用标准循环来简化它......
$query_Recordset1 = "select count(*) as count,visible
from packs
where type=1 and serial=1
group by visible";
$Recordset1 = mysqli_query($connection,$query_Recordset1) or die(mysqli_error($mysqli));
# set heading
$data = [['visible','count']];
while ($row_Recordset1 = mysqli_fetch_assoc($Recordset1) )
{
$data[] =[$row_Recordset1['visible'],(int) $row_Recordset1['count']];
}
在您的代码中,该行...
$data[$i] = array((string) mysqli_fetch_array($Recordset1)['visible'],
(int) mysqli_fetch_array($Recordset1)['count']);
检索 2 行数据,一行用于零件visible,另一行用于零件count,这就是数据偏移的原因。
- 1 回答
- 0 关注
- 74 浏览
添加回答
举报