I am trying to run the code ..I am getting this error:
Fatal error: Uncaught Error: Call to a member function fetch_row() on bool in C:\xampp\htdocs\mayuroutlet\php_action\createOrder.php:93 Stack trace: #0 {main} thrown in C:\xampp\htdocs\mayuroutlet\php_action\createOrder.php on line 93
This is the code at line 83 to 101:
for($x = 0; $x < count($_POST['productName']); $x++) {
$updateProductQuantitySql = "SELECT product.quantity FROM product WHERE product.product_id = " . $_POST['productName'][$x] . "";
$updateProductQuantityData = $connect->query($updateProductQuantitySql);
while ($updateProductQuantityResult = $updateProductQuantityData->fetch_row()) {
$updateQuantity[$x] = $updateProductQuantityResult[0] - $_POST['quantity'][$x];
// update product table
$updateProductTable = "UPDATE product SET quantity = '".$updateQuantity[$x]."' WHERE product_id = ".$_POST['productName'][$x]."";
$connect->query($updateProductTable);
What am I doing wrong?...Thanks in Advance!