PHP - PDO error -
this question has answer here:
i'm getting error pdo:
pdostatement::execute() [pdostatement.execute]: sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'key, pseudo, ip, date) values ('mykeyperso', 'mrthebigbosseur', '86.208.78.145',' @ line 1 in /home/a1394006/public_html/api/skype.php on line 51
and don't know why
my source code:
$req = $bdd->prepare('insert logs (key, pseudo, ip, date) values (:key, :pseudo, :ip, :date)'); $req->bindparam(":key", $key1, pdo::param_str); $req->bindparam(":pseudo", $pseudo1, pdo::param_str); $req->bindparam(":ip", $ip1, pdo::param_str); $req->bindparam(":date", $date, pdo::param_str); $req->execute();
my variable:
$key1 = $_get['key']; $pseudo1 = $_get['pseudo']; $ip1 = $_server['remote_addr']; $date = $_server['request_time'];
my database: http://prntscr.com/6zjsmd
so if can me plz
key reserved word in mysql. use column name, wrap in backticks (`key`). double quotes apparently work in ansi sql mode.
Comments
Post a Comment