Set group_concat_max_len on a PDO query

2020-04-03 23:26发布

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条回答
混吃等死
2楼-- · 2020-04-03 23:52

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

$conn->query("SET group_concat_max_len = 2048");
查看更多
登录 后发表回答