mysql - PDO INSERT INTO not working? -
so tried fix , read lot of questions here on stackoverflow non of them helped me. have working mysql connection pdo , can select things , stuff if try insert db wont work. there no pdo exception execution of prepared sql query wont work.
my code doesn't work:
$stmt3 = $host->prepare("insert users(username, passwort, email, key) values (:username, :passwort, :email, :key)"); try{ if(!$stmt3->execute(array(':username' => $uzernamez, ':passwort' => $password_db, ':email' => $email, ':key' => $key))) die("unknown error!"); } catch(pdoexception $ex) { die($e->getmessage()); }
it dies "unknown error!" isn't pdo exception , yes connection working because 4 lines above query if user exists , works fine.
key reserved word make sure use ` ` (backticks) wrap reserved words. – abhik chakraborty
or rename key whatever fits needs did.
Comments
Post a Comment