Click here to login."); } function getDentist($username){ $querydentist = "SELECT * FROM dentist WHERE username='$username'"; $resultdentist = mysql_query($querydentist) or die(mysql_error()); $q = mysql_fetch_array($resultdentist); $profile = persistent::factory('dentist'); $profile->dentist_id = $q['dentist_id']; $profile->password = $q['password']; $profile->email = $q['email']; return $profile; } function getPatient($patient_id){ $patientselect = mysql_query("SELECT * FROM patient WHERE patient_id = $patient_id") or die(mysql_error()); $rowpatient = mysql_fetch_assoc($patientselect); $patient = persistent::factory('patient'); $patient->first_name = $rowpatient['first_name']; $patient->middle_name = $rowpatient['middle_name']; $patient->last_name = $rowpatient['last_name']; $patient->birthdate = $rowpatient['birthdate']; $patient->home_add = $rowpatient['home_add']; $patient->prov_add = $rowpatient['prov_add']; $patient->contact_no = $rowpatient['contact_no']; $patient->sex = $rowpatient['sex']; return $patient; } function setDentist($username, $password, $email){ mysql_query("INSERT INTO dentist (dentist_id, username, password, email) VALUES ('', '$username', '$password', '$email')") or die(mysql_error()); } function updateDentist($password, $email, $username){ mysql_query("UPDATE dentist SET password = '$password', email = '$email' WHERE username='$username'") or die(mysql_error()); } function setPatient($dentist_id, $first_name, $middle_name, $last_name, $birthdate, $home_add, $prov_add, $contact_no, $sex){ mysql_query("INSERT INTO patient (patient_id, dentist_id, first_name, middle_name, last_name, birthdate, home_add, prov_add, contact_no, sex) VALUES ('', '$dentist_id', '$first_name', '$middle_name', '$last_name', '$birthdate', '$home_add', '$prov_add', '$contact_no', '$sex')") or die(mysql_error()); } function updatePatient($first_name, $middle_name, $last_name, $birthdate, $home_add, $prov_add, $contact_no, $sex, $patient_id){ mysql_query("UPDATE patient SET first_name = '$first_name', middle_name = '$middle_name', last_name = '$last_name', birthdate = '$birthdate', home_add = '$home_add', prov_add = '$prov_add', contact_no = '$contact_no', sex = '$sex' WHERE patient_id ='$patient_id'") or die(mysql_error()); } function setDentalRecord($patient_id, $dateofexamination, $agelastbirthday, $inflammationofgingiva, $presenceofdentofacialanomaly, $presenceofcalculus, $presenceofperiodontalpocket, $gingivitis, $periodontalcond, $occlusion, $habits){ mysql_query("INSERT INTO dentalrecord (dental_id, patient_id, dateofexam, agelastbirthday, gingiva, dentofacial, calculus, periodontalpocket, gingivitis, periodontalcond, occlusion, habits) VALUES ('', '$patient_id', '$dateofexamination', '$agelastbirthday', '$inflammationofgingiva', '$presenceofdentofacialanomaly', '$presenceofcalculus', '$presenceofperiodontalpocket', '$gingivitis', '$periodontalcond', '$occlusion', '$habits')") or die(mysql_error()); $dental_id = mysql_insert_id(); return $dental_id; } function setTeeth($dental_id, $tooth_no, $operation, $conditiones){ mysql_query("INSERT INTO teeth (dental_id, tooth_no, operation, conditiones) VALUES ('$dental_id', '$tooth_no', '$operation' ,'$conditiones')") or die(mysql_error()); } function deleteDentalTreat($treat){ mysql_query("DELETE from dentaltreat WHERE treat_id = $treat")or die(mysql_error()); } function deleteDentalRec($c){ mysql_query("DELETE from dentalrecord WHERE dental_id = $c")or die(mysql_error()); mysql_query("DELETE from teeth WHERE dental_id = $c") or die(mysql_error()); } function getDentalTreat($patient_id){ $resulttreat = mysql_query("SELECT * FROM dentaltreat WHERE patient_id = $patient_id") or die(mysql_error()); $dental = array(); $i = 0; while($q = mysql_fetch_assoc($resulttreat)){ $dental[$i] = persistent::factory("dental-$i"); $dental[$i]->treat_id = $q['treat_id']; $dental[$i]->patient_id = $q['patient_id']; $dental[$i]->dateoftreat = $q['dateoftreat']; $dental[$i]->diagnosis = $q['diagnosis']; $dental[$i]->tooth_count = $q['tooth_count']; $dental[$i]->details = $q['details']; $i++; } return $dental; } function setDentalTreat($patient_id, $dateoftreat, $diagnosis, $tooth_count, $details){ mysql_query("INSERT into dentaltreat (treat_id, patient_id, dateoftreat, diagnosis, tooth_count, details) VALUES ('', '$patient_id','$dateoftreat','$diagnosis','$tooth_count','$details')") or die(mysql_error()); } function getTeeth($dental_id){ $q = mysql_query("SELECT * FROM teeth WHERE dental_id = '$dental_id'") or die (mysql_error()); $teeth = array(); $i = 0; while($row = mysql_fetch_assoc($q)){ $teeth[$i] = persistent::factory('teeth'); $teeth[$i]->tooth_no = $row['tooth_no']; $teeth[$i]->operation = $row['operation']; $teeth[$i]->conditiones = $row['conditiones']; $i++; } return $teeth; } function getDentalRec($dental_id){ $q = mysql_query("SELECT * FROM dentalrecord WHERE dental_id = '$dental_id'") or die (mysql_error()); $row = mysql_fetch_assoc($q); $dental = persistent::factory('dentalrec'); $dental->dateofexam = $row['dateofexam']; $dental->agelastbirthday = $row['agelastbirthday']; $dental->gingiva = $row['gingiva']; $dental->dentofacial = $row['dentofacial']; $dental->calculus = $row['calculus']; $dental->periodontalpocket = $row['periodontalpocket']; $dental->gingivitis = $row['gingivitis']; $dental->periodontalcond = $row['periodontalcond']; $dental->occlusion = $row['occlusion']; $dental->habits = $row['habits']; return $dental; } function getDentalRecList($patient_id){ $q = mysql_query("SELECT * FROM dentalrecord WHERE patient_id = '$patient_id'") or die (mysql_error()); $dental = array(); $i = 0; while($row = mysql_fetch_assoc($q)){ $dental[$i] = persistent::factory('dental'); $dental[$i]->dental_id = $row['dental_id']; $dental[$i]->dateofexam = $row['dateofexam']; $dental[$i]->agelastbirthday = $row['agelastbirthday']; $dental[$i]->gingiva = $row['gingiva']; $dental[$i]->dentofacial = $row['dentofacial']; $dental[$i]->calculus = $row['calculus']; $dental[$i]->periodontalpocket = $row['periodontalpocket']; $dental[$i]->gingivitis = $row['gingivitis']; $dental[$i]->periodontalcond = $row['periodontalcond']; $dental[$i]->occlusion = $row['occlusion']; $dental[$i]->habits = $row['habits']; $i++; } return $dental; } function getMedHist($patient_id){ $medhistselect = mysql_query("SELECT * FROM medhist WHERE patient_id = $patient_id") or die(mysql_error()); $medhist = array(); $i = 0; while($rowmedhist = mysql_fetch_assoc($medhistselect)){ $medhist[$i] = persistent::factory("medhist"); $medhist[$i]->body = $rowmedhist['body']; $medhist[$i]->history = $rowmedhist['history']; $i++; } return $medhist; } function getPayment($patient_id){ $paymentselect = mysql_query("SELECT * FROM payments WHERE patient_id = $patient_id") or die(mysql_error()); $payment = array(); $i = 0; while($row = mysql_fetch_assoc($paymentselect)){ $payment[$i] = persistent::factory('payment'); $payment[$i]->payment_id =$row['payment_id']; $payment[$i]->dateofpayment =$row['dateofpayment']; $payment[$i]->amount_due =$row['amount_due']; $payment[$i]->amount_paid =$row['amount_paid']; $i++; } return $payment; } function deletePayment($c){ mysql_query("DELETE from payments WHERE payment_id = $c") or die(mysql_error()); } function setPayment($patient_id, $theDate, $amount_due, $amount_paid){ mysql_query("INSERT INTO payments (payment_id, patient_id, dateofpayment, amount_due, amount_paid) VALUES ('', '$patient_id', '$theDate', '$amount_due', '$amount_paid')") or die(mysql_error()); } function getAppointment($dentist_id){ $appointmentselect = mysql_query("SELECT * FROM appointment WHERE dentist_id = $dentist_id") or die (mysql_error()); $appointment = array(); $i = 0; while($rowapps = mysql_fetch_assoc($appointmentselect)){ $appointment[$i] = persistent::factory("appointment"); $appointment[$i]->appointment_id = $rowapps['appointment_id']; $appointment[$i]->date = $rowapps['date']; $appointment[$i]->time = $rowapps['time']; $appointment[$i]->appointment_with = $rowapps['appointment_with']; $i++; } return $appointment; } function setAppointment($dentist_id, $theDate, $hour, $minute, $appwith){ mysql_query("INSERT INTO appointment (appointment_id, dentist_id, date, time, appointment_with) VALUES ('', '$dentist_id', '$theDate','$hour:$minute:00' , '$appwith')") or die(mysql_error()); } function deleteAppointment($c){ mysql_query("DELETE from appointment WHERE appointment_id = $c") or die(mysql_error()); } function setMedHist($patient_id, $history, $body){ mysql_query("INSERT INTO medhist (medhist_id, patient_id, history, body) VALUES ('', '$patient_id', '$history', '$body')") or die(mysql_error()); } function updateMedHist($history, $body, $patient_id){ mysql_query("UPDATE medhist SET history = '$history' WHERE patient_id ='$patient_id' and body = '$body'") or die(mysql_error()); } function deleteMedHist($history, $body, $patient_id){ mysql_query("DELETE FROM medhist WHERE patient_id ='$patient_id' and body = '$body'") or die(mysql_error()); } ?>