Skip to content

Commit

Permalink
check for sql error
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed Nov 1, 2018
1 parent 30bba0a commit 67a12d6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sync-module/sync_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 67a12d6

Please sign in to comment.