Page 1 of 1

Part 1: Make the connection • Write a PHP file that database can be added to other PHP files using the include or requir

Posted: Tue Jul 12, 2022 8:05 am
by answerhappygod
Part 1: Make the connection • Write a PHP file that database canbe added to other PHP files using the include or require functions.• This file should: ▪ Make a connection to a MySQL database, andlog in with valid credentials. The connection resource should bestored in a variable with an appropriate name. ▪ Create a databasecalled Major if it does not exist. ▪ Select theMajor database. ▪ Create a table called Users if it does notexist with the following fields: o USERNAME VARCHAR (100) oPASSWORD VARCHAR (40) o PHONE VARCHAR (10) o EMAIL VARCHAR (50) oUSERTYPE INT ▪ The USERNAME field should be designated as UNIQUE. ▪If any of these operations cause an error, stop execution and printthe error message ▪ For USERTYPE, 1 represents the admin user and 2represents a regular user. ▪ Create a table called Tasks if doesnot exist with the following fields: o TASKID AUTO NUMBER oTASKTYPE VARCHAR(50) o TASKDESCRIPTION VARCHAR(200) o ASSIGNEDTOINT o COMPLETED VARCHAR(1)