hey guys okay so here is what i am doing:
i have a page that lists a table of patients that are in the DB if the user clicks on a patients Medical number, which is in the table, then another page is brought up where the user can update prescriptions for this patient.
BUT my problem is this: if a patient has not been assigned a prescription yet the patient is still being displayed since my sql statement says to get all patients in the DB and list them.
I want to do some test if a patient has not been assigned a prescription then dont show them in this table, only show the ones that have.
here is my code that i am using to select all the patients in the DB and put them in the TABLE (in my prescriptions table the table i have a prescription_id (primary) start_date, instructions, dose, pat_id, uom_id, and med_id) so the foreign key pat_id would get the patients id whenever a prescription is added for a certain patient!!!!)
if($role != 1) //test to make sure no other users besides doctors can access this page
$sql = "
SELECT patients.med_rec, patients.fname, patients.lname
#test if select statement works
$result = mysql_query( $sql );
$result or die("My query ($sql) failed." );