diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 6b5d9f8..2da6f05 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -101,9 +101,11 @@ class Patient extends Controller { if ($patient['Custodian'] != null) { + $custodianId = (int) $patient['Custodian']; + $patientCustodian = $this->db->table('patient') ->select('InternalPID, PatientID') - ->where('InternalPID', (int) $InternalPID) + ->where('InternalPID', $custodianId) ->get() ->getResultArray(); $patient["Custodian"] = $patientCustodian == [] ? null : $patientCustodian[0];