change rowarray to resultarray

This commit is contained in:
mahdahar 2025-09-23 09:25:13 +07:00
parent 25dc76b7b9
commit 7faf3b4e57
4 changed files with 10 additions and 12 deletions

View File

@ -87,12 +87,10 @@ class Auth extends Controller {
$sql = "SELECT * FROM users WHERE username=" . $this->db->escape($username); $sql = "SELECT * FROM users WHERE username=" . $this->db->escape($username);
$query = $this->db->query($sql); $query = $this->db->query($sql);
$row = $query->getRowArray(); $row = $query->getResultArray();
if (!$row) {
return $this->fail('User not found.', 401);
}
if (!$row) { return $this->fail('User not found.', 401); }
$row = $row[0];
if (!password_verify($password, $row['password'])) { if (!password_verify($password, $row['password'])) {
return $this->fail('Invalid password.', 401); return $this->fail('Invalid password.', 401);
} }

View File

@ -20,7 +20,7 @@ class Contact extends Controller {
$sql->select("*") $sql->select("*")
->join("contactdetail", "contact.ContactID=contactdetail.ContactID", "left") ->join("contactdetail", "contact.ContactID=contactdetail.ContactID", "left")
->join("occupation","contactdetail.OccupationID=occupation.OccupationID", "left"); ->join("occupation","contactdetail.OccupationID=occupation.OccupationID", "left");
$rows = $sql->get()->getRowArray(); $rows = $sql->get()->getResultArray();
if (empty($rows)) { if (empty($rows)) {
return $this->respond([ return $this->respond([
@ -43,7 +43,7 @@ class Contact extends Controller {
->join("contactdetail", "contact.ContactID=contactdetail.ContactID", "left") ->join("contactdetail", "contact.ContactID=contactdetail.ContactID", "left")
->join("occupation","occupation.OccupationID=contactdetail.OccupationID", "left") ->join("occupation","occupation.OccupationID=contactdetail.OccupationID", "left")
->where('contact.ContactID', (int) $ContactID) ->where('contact.ContactID', (int) $ContactID)
->get()->getRowArray(); ->get()->getResultArray();
if (empty($rows)) { if (empty($rows)) {
return $this->respond([ return $this->respond([

View File

@ -16,7 +16,7 @@ class OrderTest extends Controller {
} }
public function index() { public function index() {
$rows = $this->db->table('ordertest')->select("*")->get()->getRowArray(); $rows = $this->db->table('ordertest')->select("*")->get()->getResultArray();
if (empty($rows)) { if (empty($rows)) {
return $this->respond([ return $this->respond([
@ -34,7 +34,7 @@ class OrderTest extends Controller {
} }
public function show($OrderID = null) { 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)) { if (empty($row)) {
return $this->respond([ return $this->respond([

View File

@ -169,7 +169,7 @@ class Patient extends Controller {
->select('InternalPID, PatientID') ->select('InternalPID, PatientID')
->where('InternalPID', (int) $custodianId) ->where('InternalPID', (int) $custodianId)
->get() ->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); } if (!$input["InternalPID"] || !is_numeric($input["InternalPID"])) { return $this->respond(['status' => 'error', 'message' => 'Invalid or missing InternalPID'], 400); }
$InternalPID = $input["InternalPID"]; $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); } if (!$patient) { return $this->respond(['status' => 'error', 'message' => 'Patient not found'], 404); }
$dataPatient = $this->preparePatientData($input); $dataPatient = $this->preparePatientData($input);
@ -466,7 +466,7 @@ class Patient extends Controller {
$patient = $this->db->table('patient') $patient = $this->db->table('patient')
->where($tableName, $searchName) ->where($tableName, $searchName)
->get() ->get()
->getRowArray(); ->getResultArray();
if (!$patient) { if (!$patient) {
return $this->respond([ return $this->respond([