From ce744e7278e1cca46bdc311212a25feec19904a2 Mon Sep 17 00:00:00 2001 From: grandeljay Date: Sat, 28 Jan 2023 15:25:19 +0100 Subject: [PATCH] Fix sql syntax error --- src/classes/database.php | 2 +- src/classes/options.php | 2 +- src/pages/login.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/classes/database.php b/src/classes/database.php index 2584d00d..68b8d262 100644 --- a/src/classes/database.php +++ b/src/classes/database.php @@ -97,7 +97,7 @@ class Database ->query( 'SELECT * FROM `INFORMATION_SCHEMA`.`COLUMNS` - WHERE `TABLE_NAME` = :table_name, + WHERE `TABLE_NAME` = :table_name AND `COLUMN_NAME` = :column_name', array( 'table_name' => $table_to_check, diff --git a/src/classes/options.php b/src/classes/options.php index ec853cfb..f3475eb8 100644 --- a/src/classes/options.php +++ b/src/classes/options.php @@ -60,7 +60,7 @@ class Options if ($optionExists) { $this->database->query( 'UPDATE `options` - SET `value` = :option_value, + SET `value` = :option_value WHERE `key` = :option_key;', array( 'option_value' => $value, diff --git a/src/pages/login.php b/src/pages/login.php index a6618db6..f98b4751 100644 --- a/src/pages/login.php +++ b/src/pages/login.php @@ -21,7 +21,7 @@ if (isset($_POST['login'], $_POST['email'], $_POST['password'])) { ->query( 'UPDATE `users` SET `last_login` = NOW() - WHERE `email` = :user_email, + WHERE `email` = :user_email AND `password` = :user_password;', array( 'user_email' => $email, @@ -33,7 +33,7 @@ if (isset($_POST['login'], $_POST['email'], $_POST['password'])) { ->query( 'SELECT * FROM `users` - WHERE `email` = :user_email, + WHERE `email` = :user_email AND `password` = :user_password;', array( 'user_email' => $email,