From 8ccc05e2809bf8014e8b9817e6d35bd548365ba2 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 26 Nov 2017 11:54:49 +0100 Subject: [PATCH] upd: database.repo.user (added backquotes around table and column names) --- build/database/repo/user.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/database/repo/user.php b/build/database/repo/user.php index d1b3e37..5223588 100644 --- a/build/database/repo/user.php +++ b/build/database/repo/user.php @@ -15,7 +15,7 @@ public function getAll(){ /* (1) Statement */ - $st = $this->pdo->query("SELECT * FROM user ORDER BY username ASC"); + $st = $this->pdo->query("SELECT * FROM `user` ORDER BY `username` ASC"); /* (2) Fetched data */ return $st->fetchAll(); @@ -34,7 +34,7 @@ public function getById(int $id_user){ /* (1) Prepare Statement */ - $pst = $this->pdo->prepare("SELECT * FROM user WHERE id_user = :id_user LIMIT 1"); + $pst = $this->pdo->prepare("SELECT * FROM `user` WHERE `id_user` = :id_user LIMIT 1"); /* (2) Bind variables */ $pst->bindParam(':id_user', $id_user, \PDO::PARAM_INT); @@ -59,7 +59,7 @@ public function getByMail(String $mail){ /* (1) Prepare Statement */ - $pst = $this->pdo->prepare("SELECT * FROM user WHERE mail = :mail LIMIT 1"); + $pst = $this->pdo->prepare("SELECT * FROM `user` WHERE `mail` = :mail LIMIT 1"); /* (2) Bind variables */ $pst->bindParam(':mail', $mail, \PDO::PARAM_STR, 50); @@ -84,7 +84,7 @@ public function getByUsername(String $username){ /* (1) Prepare Statement */ - $pst = $this->pdo->prepare("SELECT * FROM user WHERE username = :username LIMIT 1"); + $pst = $this->pdo->prepare("SELECT * FROM `user` WHERE `username` = :username LIMIT 1"); /* (2) Bind variables */ $pst->bindParam(':username', $username, \PDO::PARAM_STR, 20); @@ -109,7 +109,7 @@ public function getByToken(String $token){ /* (1) Prepare Statement */ - $pst = $this->pdo->prepare("SELECT * FROM user WHERE token is not NULL AND token = :token LIMIT 1"); + $pst = $this->pdo->prepare("SELECT * FROM `user` WHERE `token` is not NULL AND `token` = :token LIMIT 1"); /* (2) Bind variables */ $pst->bindParam(':token', $token, \PDO::PARAM_STR, 128); @@ -137,7 +137,7 @@ $hash = \secure_hash($password, $id_user, 'user-pass'); /* (2) Prepare Statement */ - $pst = $this->pdo->prepare("SELECT * FROM user WHERE id_user = :id_user AND pass = :pass LIMIT 1"); + $pst = $this->pdo->prepare("SELECT * FROM `user` WHERE `id_user` = :id_user AND `pass` = :pass LIMIT 1"); /* (3) Bind variables */ $pst->bindParam(':id_user', $id_user, \PDO::PARAM_INT);