Part A: MySQL Query/Exec Create StudentsDB database in MySQL server with the following table: Table: Students uid int, Primary Key, Auto Increment studentID varchar(8), Unique name varchar(50) major varchar(50) passedCredits int CGPA float Implement the following PHP scripts as required below: php: the script should display student’s info (StudentID, name, major, credits passed and CGPA) in HTML table with appropriate title for each column. Student cells/rows should be highlighted as follows: Condition Highlight Color Student At Risk: CGPA < 2.0 Red for CGPA Cell Expected to graduate: Passed Credits >=115 Yellow for Passed Credits Cell Outstanding Student: CGPA = 3.5 or above Green for the entire Student Row php: This script should display all students’ names and major. Each student will be identified by a checkbox (define the checkbox name as a numeric array holding the uid). The user should be able to choose which student to be deleted by using its corresponding checkboxes. When the user clicks on the delete selected students button, your script should display (“Are you sure you want to delete N student’s records?” where N represents the number of selected students) and two buttons (Confirm and Cancel). Your script should delete the records permanently if the user decides to click on confirm button. If the user clicks on Cancel, the script should take the user to the first page where the user can re-select the students. Appropriate error message should be displayed in case the user didn’t select any checkbox. (No JavaScript is allowed to solve this exercise; you may need to use json_encode/json_decode functions with hidden form element to solve this part) php: Add login page so that only authorized users can view and delete students’ records. You will need to add new DB table called users and make sure all pages defined in Sections 1 and 2 are only accessible by authorized users.
Part A: MySQL Query/Exec
Create StudentsDB
Table: Students |
||||||||||||
|
Implement the following PHP scripts as required below:
- php: the script should display student’s info (StudentID, name, major, credits passed and CGPA) in HTML table with appropriate title for each column. Student cells/rows should be highlighted as follows:
Condition |
Highlight Color |
Student At Risk: CGPA < 2.0 |
Red for CGPA Cell |
Expected to graduate: Passed Credits >=115 |
Yellow for Passed Credits Cell |
Outstanding Student: CGPA = 3.5 or above |
Green for the entire Student Row |
- php: This script should display all students’ names and major. Each student will be identified by a checkbox (define the checkbox name as a numeric array holding the uid). The user should be able to choose which student to be deleted by using its corresponding checkboxes. When the user clicks on the delete selected students button, your script should display (“Are you sure you want to delete N student’s records?” where N represents the number of selected students) and two buttons (Confirm and Cancel). Your script should delete the records permanently if the user decides to click on confirm button. If the user clicks on Cancel, the script should take the user to the first page where the user can re-select the students. Appropriate error message should be displayed in case the user didn’t select any checkbox.
(No JavaScript is allowed to solve this exercise; you may need to use json_encode/json_decode functions with hidden form element to solve this part)
- php: Add login page so that only authorized users can view and delete students’ records. You will need to add new DB table called users and make sure all pages defined in Sections 1 and 2 are only accessible by authorized users.
Part 2: Prepared Statements/Transaction
Define ordersDB database in MySQL server that contains the following 2 tables as follows:
Table 1: Orders |
Table 2: OrderItems |
||||||||||||||||||
|
|
Design a simple login page with the necessary Users table in the DB. Implement the login page. When the user log-in successfully, his ID should be stored as follows:
$_SESSION[‘activeUserID’]=$UserID;
After the login page:
- The first webpage should ask for the number of products to be ordered
- The second webpage should display a form to enter all products information (product’s name, quantity, unit price) according to the number of products specified in the first webpage.
- The third webpage should process all products info from the products form and insert them into the orders and orderItems 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 (Use Transaction). In addition, you should insert all products items into the OrderItems table using PDO PREPARED STATEMENTS.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images