通过Zend Framework Update Query传递Mysql函数

时间:2021-04-05 22:45:23

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

如何使用Zend Framework在Mysql数据库中设置current_timestamp?

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.

问题是Zend框架将CURRENT_TIMESTAMP()更改为'CURRENT_TIMESTAMP()'并且Mysql将其作为字符串获取,结果在时间列中为000000000000。

1 个解决方案

#1


3  

Use :

使用 :

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

Documentation: Zend_Db_Table Programmer's Reference Guide

文档:Zend_Db_Table程序员参考指南

#1


3  

Use :

使用 :

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

Documentation: Zend_Db_Table Programmer's Reference Guide

文档:Zend_Db_Table程序员参考指南