Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

20 Points Question 4 MySQL PHP Assume you have an ORDERS database stored in MySQL server that contains the following tables with unknown number of rows: Table: customer_orders Tablet order Items Mame Type Name Type 1 ld Int(11) id int(11) 2 username varchar(100) orderld int(11) 3 datetime datetime productid int(11) 4 status varch (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 11 2 2 2021-11-04 00:00:00 Order Placed 1 1 falgaed 21 5 2 noor 2021-11-04 00:00:00 Order Placed 31 1 3 1 1 1 5 2 2 2 2 1 62 5 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);} minutes remaining cer 080 12 16 6 z' N # % 5 0 & 6 7 7 V 8 N 4 2 Y 3 U D TY! 1 1 52 2 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 is 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. Use the editor to format your answer 23 minutes remaining 1080 10 17 F4 DO * & A % V 8 $ 4. # 3 6 5 2 LYI U R

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions