In MySQLquery .I can write this
SELECT 500 as myValue FROM `myTable` WHERE 1 ;
so how to write this in codeigniter active records.
what i have tried
$this->db->select("$valas as myValue ");
but this gives
Unknown column '500' in 'field list'
Need solution apart from this
$this->db->query("$valas as myValue ");
thanks in advance.
答案 0 :(得分:2)
尝试在select
中传递false作为第二个参数$ this-> db-> select()接受可选的第二个参数。如果将其设置为FALSE,CodeIgniter将不会尝试保护您的字段或 带反引号的表名。
$this->db->select("500 as myValue", false);