简体   繁体   English

插入带有代码点火器活动记录的非文字值

[英]Insert non literal values with codeigniters active record

Is it possible to insert values like NOW() or users.username with active record. 是否可以在活动记录中插入NOW()或users.username之类的值。 Codeigniter always wraps the values in quotes. Codeigniter始终将值包装在引号中。

Yes, it is - by using the set() method with the third parameter set to FALSE. 是的,它是-通过使用set()方法并将第三个参数设置为FALSE。

$this->db->set('date', 'NOW()', FALSE);
$this->db->insert('mytable');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM