Codeigniter GROUP_CONCAT

帅比萌擦擦* 提交于 2021-02-04 21:13:06

问题


I have:

$this->db->select('GROUP_CONCAT(prod_poster, poster2, poster3, poster4, poster5, poster6, poster7)');

And I have error for this and shows sql query:

SELECT GROUP_CONCAT(prod_poster, `poster2`, `poster3`, `poster4`, `poster5`, `poster6`, `poster7)`

it's problem because of ->>>> ` near poster7. this symbol must be inside bracket. whyc codeigniter do like this? and how to fix it?


回答1:


Try doing:

$this->db->select('GROUP_CONCAT(prod_poster, poster2, poster3, poster4, poster5, poster6, poster7)', false);

If you pass false as the second argument of select(), it won't try to protect your query by adding in backticks (like it has in your example).

See: https://codeigniter.com/userguide2/database/active_record.html#select



来源:https://stackoverflow.com/questions/24546537/codeigniter-group-concat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!