I got a problem with login into CMS account after database server update - now on this server mysql 8.028 is running. Now I have info fatal error like this:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(?))' at line 1' Stack trace: #0 : PDO->prepare('SELECT * FROM s...') #1 {main}
This my connect.php:
$db = new PDO("mysql:host=".$dbhost.";dbname=".$dbname.";charset=utf8", $user, $pass, [
PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);
$db->exec("set names utf8");
$db->exec("SET SESSION sql_mode = ''");
and my login.php where to the error leads:
$sql = $db->prepare("SELECT * FROM ".$tbl_user." WHERE (user=:user) AND (pass=".$mysql_pass_type."(:pass))");
$sql->bindValue(':user', $f_user, PDO::PARAM_STR);
$sql->bindValue(':pass', $f_pass, PDO::PARAM_STR);
$sql->execute();
I've tested on different database version like 10.6.5-MariaDB and everything was OK.
Thank you in advance.