Bug #73932 [Opn]: Bind value not working in MySQL GROUP_CONCAT - Separator
| From: | cmb@php.net | Date: | Sat, 14 Jan 2017 18:39:13 +0000 |
| Subject: | Bug #73932 [Opn]: Bind value not working in MySQL GROUP_CONCAT - Separator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206623@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: cmb@php.net
Reported by: sexavet94 at gmail dot com
Summary: Bind value not working in MySQL GROUP_CONCAT -
Separator
Status: Open
Type: Bug
Package: PDO MySQL
Operating System: Linux
PHP Version: 7.0.14
Block user comment: N
Private report: N
New Comment:
*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>.
Previous Comments:
------------------------------------------------------------------------
[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