Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing MySQL's CURRENT_TIMESTAMP to Zend_DB update statement

How do I pass mysql's CURRENT_TIMESTAMP when using Zend_DB's update statement? The following doesnt seem to be working.

I have something like this:

            $update = array(
                'Name'        =>  'John',
                'DT_Modified'   =>  'CURRENT_TIMESTAMP'
            );

            $db->update('usertable', $update );

to run a query that is represented like this:

UPDATE usertable SET Name='John', DT_Modified = CURRENT_TIMESTAMP

like image 339
Jake Avatar asked Dec 14 '25 21:12

Jake


1 Answers

Try using Zend_Db_Expr to avoid unnecessary quoting:

$update = array(
    'Name'        =>  'John',
    'DT_Modified' =>  new Zend_Db_Expr('CURRENT_TIMESTAMP')
);
$db->update('usertable', $update );
like image 78
Vika Avatar answered Dec 16 '25 22:12

Vika