[英]mysql | Codeigniter Active Records are adding extra back ticks to query
When i try to run query in through codeigniter active records i get error as it is adding extra ``
当我尝试通过codeigniter活动记录运行查询时,由于添加了额外的
``
出现错误
This is the query the codeigniter is trying to execute 这是Codeigniter尝试执行的查询
SELECT `T`.`id` AS TimeSheetID, DATE_FORMAT(T.date_created, `'%M')` AS MonthName FROM (`timesheet` T)
but this is the query that i actually want to execute. 但这是我实际上要执行的查询。
SELECT `T`.`id` AS TimeSheetID, DATE_FORMAT(T.date_created, '%M') AS MonthName FROM (`timesheet` T)
how can i escape the extra colons added by the active records.. 我该如何逃避活动记录添加的多余冒号。
how can i write this statement to get the query work properly. 我如何编写此语句以使查询正常工作。
$this->db->select("
T.id AS TimeSheetID,
DATE_FORMAT(T.date_created,'%M') AS MonthName");
Add a second parameter FALSE
in your SELECT()
在您的
SELECT()
添加第二个参数FALSE
So, 所以,
$this->db->select("
T.id AS TimeSheetID,
DATE_FORMAT(T.date_created,'%M') AS MonthName", FALSE);
$this->db->select() accepts an optional second parameter. $ this-> db-> select()接受可选的第二个参数。 If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks.
如果将其设置为FALSE,则CodeIgniter不会尝试使用反引号保护您的字段或表名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.