Question: Why is the quantity not saving when i run my save.php . Whenever i submit or press enter it doesn't submit to the database. prepare
Why is the quantity not saving when i run my save.php Whenever i submit or press enter it doesn't submit to the database.
prepareSELECT userid branch FROM users WHERE username ;
$userQuerybindparams $username;
$userQueryexecute;
$userResult $userQuerygetresult;
$userRow $userResultfetchassoc;
$userId $userRowuserid;
$userBranch $userRowbranch;
$userLevel $SESSIONlevel; Fetch user level from session
foreach $ids as $id
$sizes $POSTsize$id;
$sizesString implode $sizes;
$quantity $POSTquantity$id;
$branch $userBranch; Use the branch from the user info
if $userLevel $userLevel
Update only the quantity
$orderStmt $connprepare
INSERT INTO orderbranch userid itemid quantity, size
VALUES
ON DUPLICATE KEY UPDATE
quantity VALUESquantity
;
elseif $userLevel
Update only the size
$orderStmt $connprepare
INSERT INTO orderbranch userid itemid quantity, size
VALUES
ON DUPLICATE KEY UPDATE
size VALUESsize
;
else
If user level is not or skip the operation
continue;
$orderStmtbindparamsiiis $branch, $userId, $id $quantity, $sizesString;
$orderStmtexecute;
headerLocation: order.php;
exit;
else
headerLocation: order.php;
exit;
Note: The was manually inputted through mysqltableDayMeal Type,Type,Item,Size,Color,Site,QuantityMondayLunch,Fried,Fried German Franks,Small,Large,XLBrown,On Site,MondayBreakfast,Fried,Hungarian Sausage,Small No Fry,Medium No Fry,Large,Brown,On Site,MondayBreakfast,Fried,Fried Luncheon Meat,Small,Brown,On Site,
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
