PDO and UPDATE problem

From: Date: Wed, 21 Jul 2010 13:04:33 +0000
Subject: PDO and UPDATE problem
Groups: php.general 
Request: Send a blank email to php-general+get-307062@lists.php.net to get a copy of this message
Hello I have a problem with a update using PDO. (learning atm and updating a php class to use PDO) private function updateUser($id) { $date = mktime(); $DB = Db::getInstance(); $stmt = $DB->prepare('"UPDATE '. TBL_USERS .' SET date_last_action=:updateDate WHERE id=:userId'); $stmt->bindParam(":updateDate", $date); $stmt->bindParam(":userId", $id); $stmt->execute(); } It does not work. I get 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 '"UPDATE mf_Users SET date_last_action='1279717039' WHERE id='1'' at line 1' in /public_html/forum/includes/classes/Auth.class.php on line *157* PDO works and is fine with my SELECT request's. Does not seam to work with this simple UPDATE. I tested the request in PHPMyAdmin and it works. (UPDATE mf_Users SET date_last_action='1279717039' WHERE id='1') Thx, Sky

« previous php.general (#307062) next »