Set group_concat_max_len on a PDO query

拜拜、爱过 提交于 2019-12-01 15:32:46

问题


I have the following query:

$cases = $conn->prepare("SELECT GROUP_CONCAT(text SEPARATOR '|') as texts, year FROM cases GROUP BY year ORDER BY ano DESC");
$cases->execute();
$cases_result = $cases->fetchAll(PDO::FETCH_OBJ);

But some texts are not showing completely

So I have to change the value of group_concat_max_len. I did as follows:

mysql_query("SET group_concat_max_len = 2048");

But using PDO not know how


回答1:


Can you not use $conn->query()?

$conn->query("SET group_concat_max_len = 2048");


来源:https://stackoverflow.com/questions/18153293/set-group-concat-max-len-on-a-pdo-query

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