safecat 发表于 2010-11-12 11:19:03

如何在db->insert()中使用mysql函数


$data = array(
        'title'        =>        $this->input->post('title',true),
        'body'        =>        $this->input->post('title',true),
        'time'        =>        ' NOW() ',
        'cid'        =>        $this->input->post('cid',true),
);
$this->article->add($data);


NOW()被当做字符串加入了,如果这里不用PHP的时间函数生成时间,CI有提供什么方法让这里能否执行MYSQL函数吗?

visvoy 发表于 2010-11-12 11:31:04

$this->db->set('time','NOW()',false);
认真看手册

safecat 发表于 2010-11-12 11:46:50

嗯。感谢指点。。以后一定认真看手册。。
页: [1]
查看完整版本: 如何在db->insert()中使用mysql函数