" . $db_server->connect_error . "
"); } else { // We successfully connected to the database // The prepared query is a special kind of string: $orders_query = "INSERT INTO orders(eno, cno) VALUES (?,?)"; $orders_stmt = $db_server->prepare($orders_query); /* UPDATE HERE You need a prepared query that inserts ono, pno, and qty values into odetails */ if (!$odetails_stmt || !$orders_stmt) { // There was an error preparing the query print ("" . $odetails_stmt->error . "
"); } else { $eno = $_POST['eno']; $cno = $_POST['cno']; if (!$orders_stmt->bind_param("ii", $eno, $cno)){ // There was an error binding the parameters print ("" . $orders_stmt->error . "
"); } else { if (!$orders_stmt->execute()){ print ("" . $orders_stmt->error . "
"); } else { // Get the order id generated by the INSERT statement $ono = $orders_stmt->insert_id; $pno = $_POST['pno']; $qty = $_POST['qty']; $bind_result = // UPDATE HERE You need to bind the three parameters of your odetails query if (!$bind_result){ // There was an error binding the parameters print ("" . $odetails_stmt->error . "
"); } else { $execute_result = ; // UPDATE HERE You need to execute your prepared query if (!$execute_result){ print ("" . $odetails_stmt->error . "
"); } else { $orders_query2 = "SELECT cname, ename, pname, qty FROM orders, employees, customers, odetails, parts WHERE orders.eno=employees.eno AND orders.cno = customers.cno AND orders.ono = odetails.ono AND odetails.pno = parts.pno"; $odetails_query2 = "SELECT ono, pname, qty FROM odetails JOIN parts ON odetails.pno=parts.pno"; $orders_res = $db_server->query($orders_query2); $odetails_res = $db_server->query($odetails_query2); $num_orders = $orders_res->num_rows; $num_odetails = $odetails_res->num_rows; for ($cur_order_num = 0; $cur_order_num < $num_orders; $cur_order_num++){ $orders_res->data_seek($cur_order_num); $cur_order = $orders_res->fetch_assoc(); print "Employee: " . $cur_order['ename'] . " Customer: " . $cur_order['cname'] . " Part : " . $cur_order['pname'] . " Quantity: " . $cur_order['qty'] . "
" . $db_server->connect_error . "
"); } function print_customer ($customer) { print ""; } ?>