Question: PHP web front end for MYSQL database I have already created the MYSQL database already so no need for that, it conists of six tables:

PHP web front end for MYSQL database

I have already created the MYSQL database already so no need for that, it conists of six tables: Workplace, staff_details, case, log, login_details and quiz. Basically, I need a PHP front end for my database so to access it, to query the database and to be able to add to the case table, once a case has been created it is added to the log table where cases are either pending or resolved (Uses TINYINT() with the size 1. So that it can store only 2 values 0 or 1. 0 means false and 1 means true).

A case consists of Case_ID, Employee_ ID (foreign key), workplace_ID (foreign key), date and description. and here is some code which needs to be encorporated into the PHP front end, as the database will also receive data from an IOS app.

PHP web front end for MYSQL database I have already created the

Thank you in advance, have a good day.

?php connecting to my SRL database sdb hostname db database $db username $db password $con my agli connect ($db hostname, db u db password, sername $db database if (!scon) die "unable to connect to MysoL: ".myaqli connect error function login. $decoded json decode jsonInput, true) a ios app will send JSON to php containing username and password input. $loginQuery select username password FROM Eunsure of table name $correct Login false while row mysqli fetch assoc loginQuery) if ($row Username "J) json Input "Username if ($row ["Password"] json Input password correct true Login break echo json encode ($correctLogin) Ereturns true if correct login false if incorrect. function submitIncident $decoded json decode jsonInput, true ios app will send JSON containing date description, the php will generate the unique incident ID $incident Query select from incident $inciden Res myeqli query ($con, $incidentQuery) $rows my agli num rows ($incident Res $Incident ID rows 1. $insertQuery insert into incident Incident ID Date, Employee ID Branch ID Description values $Incident ID decoded Date decoded [Employee ID $decoded [Branch ID $decoded [Descriptions success my agli query ($con, sinsertQuery) echo Success ?php connecting to my SRL database sdb hostname db database $db username $db password $con my agli connect ($db hostname, db u db password, sername $db database if (!scon) die "unable to connect to MysoL: ".myaqli connect error function login. $decoded json decode jsonInput, true) a ios app will send JSON to php containing username and password input. $loginQuery select username password FROM Eunsure of table name $correct Login false while row mysqli fetch assoc loginQuery) if ($row Username "J) json Input "Username if ($row ["Password"] json Input password correct true Login break echo json encode ($correctLogin) Ereturns true if correct login false if incorrect. function submitIncident $decoded json decode jsonInput, true ios app will send JSON containing date description, the php will generate the unique incident ID $incident Query select from incident $inciden Res myeqli query ($con, $incidentQuery) $rows my agli num rows ($incident Res $Incident ID rows 1. $insertQuery insert into incident Incident ID Date, Employee ID Branch ID Description values $Incident ID decoded Date decoded [Employee ID $decoded [Branch ID $decoded [Descriptions success my agli query ($con, sinsertQuery) echo Success

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!