Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_id' in 'field list' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order_id' in 'field list'

$statement = $conn->query("SELECT LAST_INSERT_ID()"); $order_id = $statement->fetchColumn(); for($count=0; $count<$_POST["total_item"]; $count++) { $sub_total = $sub_total + floatval(trim($_POST["order_item_actual_amount"][$count])); $discount = $discount + floatval(trim($_POST["discount_amount"][$count])); $total_after_discount = $total_after_discount + floatval(trim($_POST["order_item_final_amount"][$count])); $statement = $conn->prepare(" INSERT INTO tbl_medlab_item (order_id,item_type, item_name, order_item_quantity, order_item_price, order_item_actual_amount, discount, discount_amount, order_item_final_amount) VALUES (:order_id, :item_type, :item_name, :order_item_quantity, :order_item_price, :order_item_actual_amount, :discount, :discount_amount, :order_item_final_amount) "); //order_id IS PRESENT IN BOTH TABLE (tbl_medlab and tbl_medlab_item) $statement->execute( array( ':order_id' => $order_id, ':item_type' => trim($_POST["item_type"][$count]), ':item_name' => trim($_POST["item_name"][$count]), ':order_item_quantity' => trim($_POST["order_item_quantity"][$count]), ':order_item_price' => trim($_POST["order_item_price"][$count]), ':order_item_actual_amount' => trim($_POST["order_item_actual_amount"][$count]), ':discount' => trim($_POST["discount"][$count]), ':discount_amount' => trim($_POST["discount_amount"][$count]), //ERROR PART START HERE ':order_item_final_amount' => trim($_POST["order_item_final_amount"][$count]) //ERROR PART END's HERE ) ); }

6th Apr 2022, 12:06 PM
Ryuki Gil
Ryuki Gil - avatar
0 Answers