Hello Everybody.
i have a problem with the following:
$sql = "SELECT * FROM Inventory WHERE Onhand > 0";
foreach ($o_DB->query($sql) as $row) {
...
$sql_AType = "SELECT * FROM ProdCateg where ProdID = $row['ProdID']";
foreach ($o_DB->query($sql_AType) as $row_AType) {
...
$c_SQL = "UPDATE Inventory SET
Onhand = $n_NewOnhand,
Allocated = $n_NewAllocated
WHERE
ProdID = $row['ProdID']";
$stmt = $o_DB->prepare($c_SQL);
$stmt->Execute();
}
}
Now, the inner foreach loops twice in this scenario.
My problem is that the $row['onhand'] does not get updated.
Any Ideas on how to do this correctly?
Any Help is greatly appreciated!
i have a problem with the following:
$sql = "SELECT * FROM Inventory WHERE Onhand > 0";
foreach ($o_DB->query($sql) as $row) {
...
$sql_AType = "SELECT * FROM ProdCateg where ProdID = $row['ProdID']";
foreach ($o_DB->query($sql_AType) as $row_AType) {
...
$c_SQL = "UPDATE Inventory SET
Onhand = $n_NewOnhand,
Allocated = $n_NewAllocated
WHERE
ProdID = $row['ProdID']";
$stmt = $o_DB->prepare($c_SQL);
$stmt->Execute();
}
}
Now, the inner foreach loops twice in this scenario.
My problem is that the $row['onhand'] does not get updated.
Any Ideas on how to do this correctly?
Any Help is greatly appreciated!