From 3e43b72eece15c94177f3f8d5399edf3e62bd6ec Mon Sep 17 00:00:00 2001 From: Minh Cuong Tran Date: Wed, 28 Feb 2024 16:56:39 +0100 Subject: [PATCH] Inconsistency of using DATABASE_PREFIX with getOne() --- src/index.php | 2 +- src/lib/Users/Users.php | 2 +- src/read.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.php b/src/index.php index 5e7bc19..66a0416 100644 --- a/src/index.php +++ b/src/index.php @@ -26,7 +26,7 @@ if($_SESSION['type'] !== 'super') { $db->where("id_owner", $_SESSION['user_id']); $db->orWhere ("id_owner", NULL, 'IS'); } -$numScan = $db->getOne(DATABASE_PREFIX."dynamic_qrcodes", "sum(scan) as numScan"); +$numScan = $db->getOne("dynamic_qrcodes", "sum(scan) as numScan"); /* CREATED CHART */ //I initialize the variables that will contain the daily values to 0 otherwise in the foreach loop they will be reset every time diff --git a/src/lib/Users/Users.php b/src/lib/Users/Users.php index e81610d..0851906 100644 --- a/src/lib/Users/Users.php +++ b/src/lib/Users/Users.php @@ -40,7 +40,7 @@ class Users $db = getDbInstance(); $db->where('id', $id); - $result = $db->getOne(DATABASE_PREFIX.'users'); + $result = $db->getOne('users'); if($result !== NULL) return $result; diff --git a/src/read.php b/src/read.php index 27bef52..2a99ee5 100644 --- a/src/read.php +++ b/src/read.php @@ -7,7 +7,7 @@ if($_SERVER["REQUEST_METHOD"] !== "GET" || !isset($_GET['id'])) $db = getDbInstance(); $db->where("identifier", $_GET['id']); -$qrcode = $db->getOne(DATABASE_PREFIX."dynamic_qrcodes"); +$qrcode = $db->getOne("dynamic_qrcodes"); $data = array ( 'scan' => $db->inc(1)