Question
What is the best way to connect everything together? Would I need to create a table for Patient, Medications, Demographic about Patients, and Treatment Plan?
What is the best way to connect everything together? Would I need to create a table for Patient, Medications, Demographic about Patients, and Treatment Plan?
Part A: Create the database from your last assignment (Week4 Lab). Name the database doctorWho. Then create a page that allows Doctor Whos assistant to add a new patient record. You will need to give the assistant rights to this database. The assistants username is 'helper' and the password is 'feelBetter'. For this to work, you will need to create several pages so be sure to include all of them when submitting your work. Name the main page addPatient.php.
Part B: Add at least five records to the patients table in the doctorWho database you created in PartA. Now create a page that will display three or more fields from each of these records. The display should consist of, at a minimum, the patients first and last names and a unique identifier. Name the page getPatient.php and be sure to include the necessary accompanying files when you submit your work.
Here is my sketch from last week:
addPatient.html
Add Patient
addPatient.php
$patientid=$_POST["patientid"]; $firstname=$_POST["firstname"]; $lastname=$_POST["lastname"]; $gender=$_POST["gender"]; $treatmentplan=$_POST["treatmentplan"];
//sql query $sql="INSERT INTO patients (patientid, firstname, lastname, gender, treatmentplan) Values('$patientid', '$firstname', '$lastname', '$gender', '$treatmentplan';
if($conn->query($sql)===TRUE){ echo "Patient added successfully"; } else { echo "Error:" .$sql. " " .$conn->error; }
//close connection $conn->close(); ?>
database.php
//Connection $conn = new mysquli($servername, $username, $password, $dbname);
//Check Connection if($conn->connect_error){ die("Connection failed:" .$conn->connect_error); }
?>
viewPatients.php
//sql query $sql="SELECT * FROM PATIENTS";
//execute $result = $conn->query($sql);
//if any result if($result->num_rows>0){ echo"
Patient ID | First Name | Last Name | Gender | Treatment Plan | "; while($row=$result->fetch_assoc()){ echo"
---|---|---|---|---|
".$row["patientid"]." | ".$row['firstname']." | ".$row['lastname']." | ".$".row['gender']." | ".$row['treatmentplan']." |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started