PDO and UPDATE problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux