Bug #73932 [Opn->Nab]: Bind value not working in MySQL GROUP_CONCAT - Separator

From: Date: Thu, 10 Dec 2020 11:37:58 +0000
Subject: Bug #73932 [Opn->Nab]: Bind value not working in MySQL GROUP_CONCAT - Separator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230991@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73932&edit=1 ID: 73932 Updated by: nikic@php.net Reported by: sexavet94 at gmail dot com Summary: Bind value not working in MySQL GROUP_CONCAT - Separator -Status: Open +Status: Not a bug Type: Bug Package: PDO MySQL Operating System: Linux PHP Version: 7.0.14 Block user comment: N Private report: N New Comment: This works fine with emulated prepared statements. It does not work with native prepared statements, but as @cmb pointed out, this is a MySQL limitation. Previous Comments: ------------------------------------------------------------------------ [2017-01-14 18:39:12] cmb@php.net *At least* with regard to native prepared statements this is not a PHP/PDO issue, but rather a MySQL problem, see <https://bugs.mysql.com/bug.php?id=17832>. ------------------------------------------------------------------------ [2017-01-14 10:18:18] sexavet94 at gmail dot com Description: ------------ Hello. There is a bug in PDO's MySQL driver. It is necessary to write SQL query like this: SELECT GROUP_CONCAT( title SEPARATOR '\'' ) FROM tblNews GROUP BY date I bind value to the separator by PDO but it doesn't work. Test script: --------------- <?php // ... $this->connection = new PDO('mysql:host=' . $configurations['host'] . ';dbname=' . $configurations['database'] . '; charset=utf8', $configurations['user'], $configurations['password']); $sth = $this->connection->prepare("SELECT GROUP_CONCAT( title SEPARATOR ? ) FROM tblNews GROUP BY date"); $sth->bindValue(1 , ':'); $sth->execute(); var_dump($sth->fetch()); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73932&edit=1

« previous php.bugs (#230991) next »