Untitled
unknown
plain_text
a year ago
1.5 kB
1
Indexable
Never
if ($enableCSV == 1) { $mrn = trim(data['pi01']); if ($mrn != '') { $sqlpid = "SELECT * FROM $patienttable where Unique_Patient_ID='$mrn'"; $resulthpid = $conn->query($sqlpid); $tempdata = $resulthpid->fetch_assoc(); if (is_null($tempdata)) { $dob = ''; if (trim($data['pi05']) != '') { try { $date = DateTime::createFromFormat('m/d/Y', trim($data['pi05'])); $dob = $date->format('Y-m-d'); } catch (Exception $e) { // echo 'Caught exception: ', $e->getMessage(), "\n"; } } $sql = "INSERT INTO $patienttable (Hospital_Name, Patient_First_Name, Patient_Last_Name, Patient_DOB, Patient_Sex, Patient_Visit_Number, Contact_Serial_Number, Unique_Patient_ID, Social_Security_Number, Patient_Phone_Number, Patient_Email, Site_Name, Site_Number, MRN1, MRN2, MRN3, MRN4) VALUES ('', '".$data['pi03']."' , '".$data['pi04']."' , '".$dob."' , '".$data['pi07']."' , '".$data['visitnumber']."' , '".$data['pi02']."' , '".$data['pi01']."' , '' , '".$data['pi08']."' , '".$data['pi09']."' , '' , '' , '".$data['pi01']."' , '' , '' , '' )"; if (mysqli_query($conn, $sql) === TRUE) { // echo "New record created successfully"; } else { //echo "Error: " . $query . "<br>" . $conn->error; } } }