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' => 'J开发者_开发技巧ohn',
'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
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 );
精彩评论