Sdb-new PDO('mysql:host-localhost;dbname-ordersDB;charset-utf8', 'root', 'abc123); Sdb->setAttribute(PDO::ATTR_ERRMODE, PDO:ERRMODE EXCEPTION); Assume the user has added several products in his shopping cart and all his selection is stored in PHP Session variable using the following data structure: When the user log-in successfully, his ID is stored as follows: $_SESSION['activeUserID'J-SUserID; for each Product in the shopping cart: $ SESSION[SUserlID][SProductName] = array($Quantity, SUnitPrice); Implement placeOrder.php as follows: the script should process all products info from the User shopping cart SESSION and insert them into the orders and orderItems tables. Your script should insert the userID, order total amount and order date and time into the orders table and then insert each product details in the orderItems table. Your script should make sure All details are inserted successfully or none of them. In addition, you should insert all products items into the OrderItems table using PDO PREPARED STATEMENTS.

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter1: Overview Of Database Concepts
Section: Chapter Questions
Problem 5HOA: Access path A database table is composed of records and fields hold data. Data is stored in records....
icon
Related questions
Question
Sab-new PDO(mysql:host-localbost;dbname-ordersDB;charset-utf8', 'root', abc123);
Sdb->setAttribute(PDO::ATTR_ERRMODE, PDO:ERRMODE EXCEPTION);
Assume the user has added several products in his shopping cart and all his selection
is stored in PHP Session variable using the following data structure:
When the user log-in successfully, his ID is stored as follows:
S_SESSION['activeUserID']=SUserID;
for each Product in the shopping cart:
$ SESSION[SUserID][SProductName] = array($Quantity, SUnitPrice);
Implement placeOrder.php as follows: the script should process all products info
from the User shopping cart SESSION and insert them into the orders and orderItems
tables. Your script should insert the userID, order total amount and order date and time
into the orders table and then insert each product details in the orderItems table. Your
script should make sure All details are inserted successfully or none of them. In
addition, you should insert all products items into the OrderItems table using PDO
PREPARED STATEMENTS.
Transcribed Image Text:Sab-new PDO(mysql:host-localbost;dbname-ordersDB;charset-utf8', 'root', abc123); Sdb->setAttribute(PDO::ATTR_ERRMODE, PDO:ERRMODE EXCEPTION); Assume the user has added several products in his shopping cart and all his selection is stored in PHP Session variable using the following data structure: When the user log-in successfully, his ID is stored as follows: S_SESSION['activeUserID']=SUserID; for each Product in the shopping cart: $ SESSION[SUserID][SProductName] = array($Quantity, SUnitPrice); Implement placeOrder.php as follows: the script should process all products info from the User shopping cart SESSION and insert them into the orders and orderItems tables. Your script should insert the userID, order total amount and order date and time into the orders table and then insert each product details in the orderItems table. Your script should make sure All details are inserted successfully or none of them. In addition, you should insert all products items into the OrderItems table using PDO PREPARED STATEMENTS.
PHP/MYSQL Question
Assume you have ordersDB database stored in MYSQL server that contains the
following 2 tables as follows:
...
Table 1: Orders
Table 2: OrderlItems
int, Primary Key, Auto
Increment
orderID
itemID
int, Primary Key, Auto
Increment
userID
int
orderID
int, Foreign Key
productName varchar(50)
int
total
double
orderDate
datetime
quantity
unitPrice
double
Use the following Connection.php by including it in your scripts which connect you
to MYSQL server and the database.
<?php
Sdb-new PDO('mysql:host-localhost;dbname-ordersDB;charset-utf8', 'root', 'abc123');
Sdb->setAttribute(PDO::ATTR ERRMODE, PD0::ERRMODE EXCEPTION);
Transcribed Image Text:PHP/MYSQL Question Assume you have ordersDB database stored in MYSQL server that contains the following 2 tables as follows: ... Table 1: Orders Table 2: OrderlItems int, Primary Key, Auto Increment orderID itemID int, Primary Key, Auto Increment userID int orderID int, Foreign Key productName varchar(50) int total double orderDate datetime quantity unitPrice double Use the following Connection.php by including it in your scripts which connect you to MYSQL server and the database. <?php Sdb-new PDO('mysql:host-localhost;dbname-ordersDB;charset-utf8', 'root', 'abc123'); Sdb->setAttribute(PDO::ATTR ERRMODE, PD0::ERRMODE EXCEPTION);
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning