0
我想檢索item
名稱item
表,它等於inventory
表中的item numver,而清單中的其他詳細信息則直接填充。但它不運行。我該如何糾正?數據庫加入並檢索到PHP
<?php include '../../config/Database.php';
$pdo = Database::connect();
$sql = 'SELECT * FROM `tbl_inventory`';
$sql2 = 'SELECT tbl_item.item_name FROM tbl_item,tbl_inventory
WHERE tbl_inventory.tbl_item_item_ID = tbl_item.item_ID';
foreach ($pdo->query($sql) as $row) {
echo '<tr>';
echo '<td>' . $row['tbl_item_item_ID'] . '</td>';
foreach ($pdo->query($sql2) as $row1) {
echo '<td>' . $row1['item_name'] . '</td>';
}
echo '<td>' . $row['qty'] . '</td>';
echo '</tr>';
}
Database::disconnect();
?>
你得到什麼錯誤? – Mureinik