From 67a12d6ff1da70a9d3a6432f0688d60a82ec71a8 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Thu, 1 Nov 2018 15:24:48 +0000 Subject: [PATCH] check for sql error --- sync-module/sync_model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sync-module/sync_model.php b/sync-module/sync_model.php index 1212b07..458ecbe 100644 --- a/sync-module/sync_model.php +++ b/sync-module/sync_model.php @@ -30,7 +30,10 @@ public function __construct($mysqli) public function remote_load($userid) { $userid = (int) $userid; - $result = $this->mysqli->query("SELECT * FROM sync WHERE `userid`='$userid'"); + if (!$result = $this->mysqli->query("SELECT userid,host,apikey_read,apikey_write FROM sync WHERE `userid`='$userid'")) { + return array("success"=>false, "message"=>"SQL error"); + } + if ($row = $result->fetch_object()) return $row; return array("success"=>false); }