1
votes

How can I set current_timestamp in Mysql database using Zend Framework?

I do this for an update query:

$data=array("usercode"=>$username,
                "active"=>1,
                "activation_tme"=>"CURRENT_TIMESTAMP()");

The problem is that Zend framework changes CURRENT_TIMESTAMP() to 'CURRENT_TIMESTAMP()' and Mysql get it as a string and the result is 000000000000 in time column.

1

1 Answers

3
votes

Use :

$data = array("usercode"       => $username,
              "active"         => 1,
              "activation_tme" => new Zend_Db_Expr('CURRENT_TIMESTAMP()'));

Documentation: Zend_Db_Table Programmer's Reference Guide