diff --git a/app/Controllers/Auth.php b/app/Controllers/Auth.php index 442b6e9..230cbab 100644 --- a/app/Controllers/Auth.php +++ b/app/Controllers/Auth.php @@ -87,12 +87,10 @@ class Auth extends Controller { $sql = "SELECT * FROM users WHERE username=" . $this->db->escape($username); $query = $this->db->query($sql); - $row = $query->getRowArray(); - - if (!$row) { - return $this->fail('User not found.', 401); - } + $row = $query->getResultArray(); + if (!$row) { return $this->fail('User not found.', 401); } + $row = $row[0]; if (!password_verify($password, $row['password'])) { return $this->fail('Invalid password.', 401); } diff --git a/app/Controllers/Contact.php b/app/Controllers/Contact.php index 96aa9db..3a891e5 100644 --- a/app/Controllers/Contact.php +++ b/app/Controllers/Contact.php @@ -20,7 +20,7 @@ class Contact extends Controller { $sql->select("*") ->join("contactdetail", "contact.ContactID=contactdetail.ContactID", "left") ->join("occupation","contactdetail.OccupationID=occupation.OccupationID", "left"); - $rows = $sql->get()->getRowArray(); + $rows = $sql->get()->getResultArray(); if (empty($rows)) { return $this->respond([ @@ -43,7 +43,7 @@ class Contact extends Controller { ->join("contactdetail", "contact.ContactID=contactdetail.ContactID", "left") ->join("occupation","occupation.OccupationID=contactdetail.OccupationID", "left") ->where('contact.ContactID', (int) $ContactID) - ->get()->getRowArray(); + ->get()->getResultArray(); if (empty($rows)) { return $this->respond([ diff --git a/app/Controllers/OrderTest.php b/app/Controllers/OrderTest.php index ae8699a..9a672dc 100644 --- a/app/Controllers/OrderTest.php +++ b/app/Controllers/OrderTest.php @@ -16,7 +16,7 @@ class OrderTest extends Controller { } public function index() { - $rows = $this->db->table('ordertest')->select("*")->get()->getRowArray(); + $rows = $this->db->table('ordertest')->select("*")->get()->getResultArray(); if (empty($rows)) { return $this->respond([ @@ -34,7 +34,7 @@ class OrderTest extends Controller { } public function show($OrderID = null) { - $row=$this->db->table('ordertest')->select("*")->where('OrderID=', $OrderID)->get()->getRowArray(); + $row=$this->db->table('ordertest')->select("*")->where('OrderID=', $OrderID)->get()->getResultArray(); if (empty($row)) { return $this->respond([ diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index d317538..bf5fcbe 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -169,7 +169,7 @@ class Patient extends Controller { ->select('InternalPID, PatientID') ->where('InternalPID', (int) $custodianId) ->get() - ->getRowArray() ?: null; + ->getResultArray() ?: null; } @@ -344,7 +344,7 @@ class Patient extends Controller { if (!$input["InternalPID"] || !is_numeric($input["InternalPID"])) { return $this->respond(['status' => 'error', 'message' => 'Invalid or missing InternalPID'], 400); } $InternalPID = $input["InternalPID"]; - $patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRowArray(); + $patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getResultArray(); if (!$patient) { return $this->respond(['status' => 'error', 'message' => 'Patient not found'], 404); } $dataPatient = $this->preparePatientData($input); @@ -466,7 +466,7 @@ class Patient extends Controller { $patient = $this->db->table('patient') ->where($tableName, $searchName) ->get() - ->getRowArray(); + ->getResultArray(); if (!$patient) { return $this->respond([