gpt4 book ai didi

php - mysqli_fetch_array() 中的警告

转载 作者:行者123 更新时间:2023-11-30 23:43:21 24 4
gpt4 key购买 nike

为什么我的数组因为 mysqli_fecth 数组而出错?我可以对代码做的事情是真实的,因为我是这方面的初学者。我将我的代码更改为 mysqli_fetch_assoc() 但错误是一样的。

这是我编写的代码:

      <?php
$query = mysqli_query($con,"SELECT t.po_nomor, p.nama_supplier, p1.nama_barang , t.total FROM
(SELECT t1.po_nomor, (SUM(t1.jumlah)-SUM(COALESCE(t4.terima,0))over(PARTITION by t4.refrence) ) as total
FROM pengiriman_supply t1
INNER JOIN data_supplier t2 ON t1.idsupplier = t2.id_supplier
INNER JOIN data_barang t3 ON t1.idbarang = t3.idbarang
LEFT JOIN masuk t4 ON t4.refrence = t1.po_nomor
where t1.tanggal BETWEEN date_sub(curdate(), interval 120 day) AND curdate()
group by t1.po_nomor,t4.po_nomor) t
INNER JOIN pengiriman_supply s ON s.po_nomor = t.po_nomor
INNER JOIN data_supplier p ON s.idsupplier = p.id_supplier
INNER JOIN data_barang p1 ON s.idbarang = p1.idbarang
GROUP BY t.po_nomor
ORDER by t.po_nomor DESC;");
$no = 0;
while($data = mysqli_fetch_array($query)){
$no++;
?>
<tr>
<td><?= $no ?></td>
<td><?= $data['po_nomor'] ?></td>
<td><?= $data['nama_supplier'] ?></td>
<td><?= $data['nama_barang'] ?></td>
<td><?= $data['total'] ?></td>

</tr>
<?php
}
?> </tbody>

我可以在哪里更改我的代码。

最佳答案

你尝试将它粘贴到你的 sql 命令中,如果它不起作用,那么这里有问题。

SELECT t.po_nomor, p.nama_supplier, p1.nama_barang , t.total FROM 
(SELECT t1.po_nomor, (SUM(t1.jumlah)-SUM(COALESCE(t4.terima,0))over(PARTITION by t4.refrence) ) as total
FROM pengiriman_supply t1
INNER JOIN data_supplier t2 ON t1.idsupplier = t2.id_supplier
INNER JOIN data_barang t3 ON t1.idbarang = t3.idbarang
LEFT JOIN masuk t4 ON t4.refrence = t1.po_nomor
where t1.tanggal BETWEEN date_sub(curdate(), interval 120 day) AND curdate()
group by t1.po_nomor,t4.po_nomor) t
INNER JOIN pengiriman_supply s ON s.po_nomor = t.po_nomor
INNER JOIN data_supplier p ON s.idsupplier = p.id_supplier
INNER JOIN data_barang p1 ON s.idbarang = p1.idbarang
GROUP BY t.po_nomor
ORDER by t.po_nomor DESC;

关于php - mysqli_fetch_array() 中的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59297406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com