Assignment 4
Instructions
Assignment
For this assignment, you will write two PHP files. Put these files together in a folder, then zip them together and upload them to Blackboard. In Windows, you can zip files by selecting them, right-clicking, and choosing “send to -> compressed (zipped) folder”.
For both files, you should use the following parameters:
Server name: “localhost”
User name: “user1”
Password: “secret123”
Database name: “database”
Your first file should be named with your NetId and the letter ‘a’. For example, if your NetId is jsmith1, this file should be named “jsmith1a.php”.
The file should enter the following records into the table Employees:
lastname: Johnson, firstname: Fred, department: ACCT
lastname: Sanchez, firstname: Betty, department: FIN
lastname: Wu, firstname: John, department: MKTG
lastname: Johnson, firstname: Susie, department, FIN
lastname: Fiori, firstname: Maria, department: MKTG
lastname: Patel, firstname: Sandeep, department: ACCT
For each record, a confirmation message should be displayed including the record’s fields, i.e., “new record created for Fred Johnson (ACCT)”. You might try using a function that accepts the requisite parameters and prints them. More details at:
PHP Functions (w3schools.com)
Your second file should be named with your NetId and the letter ‘b’. For example, if your NetId is jsmith1, this file should be named “jsmith1b.php”.
The file should run two queries on the table Employees to display:
All records where the department is FIN
All records where the lastname is Johnson or the department is ACCT
All records where the lastname is Fiori and the department is MKTG
Each set of records should be preceded by the description of the query. The three sets of query results should be separated by a blank line of text.
Evaluation
Your assignment will be graded according to whether all the required elements are present and in the correct formats and all required functionalities are operable.