Question: ... Question 4 MySQL/PHP Assume you have an ORDERS database stored in MySQL server that contains the following tables with unknown number of rows: Tablet

 ... Question 4 MySQL/PHP Assume you have an ORDERS database stored
in MySQL server that contains the following tables with unknown number of

... Question 4 MySQL/PHP Assume you have an ORDERS database stored in MySQL server that contains the following tables with unknown number of rows: Tablet customer_orders Tables order Items Name Type Name Type 1 id id int(11) 2 username varchar(100) orderid int(11) 3 datetime datetime productid int(11) 4 status varchar(100) qty int(11) Note: ordered is a foreign key to an id in customer_orders Sample Data Table: customer_orders Table: order_items id username datetime status id orderid productid aty 1 falqaed 2021-11-04 00:00:00 Order Placed 1 1 2 21 5 2 noor 2021-11-04 00:00:00 Order Placed 3 1 3 1 4 1 1 2 2 5 2 5 1 6 2 Use the following connection.php by including it in your scripts, which connects you to MySQL server and the database. setAttribute(PDO::ATTR ERRMODE, PDO::ERRMODE EXCEPTION):) Assume a user has logged in successfully and added many products of different quantities in his shopping basket. All this information saved in Session Variables as follows: $_SESSION['activeUser'] holds the username $_SESSION['CART"] holds an associative array whose key is the product id and its value is the quantity selected. Q4-A: Write the required PHP statements to insert the customer order from the shopping basket into the two database tables. Your code must ensure that the order is completely inserted successfully or not. In addition, you must use prepared statement to insert the order items. Once inserted all, your code should display the number of items inserted successfully in green color

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!