php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73932 Bind value not working in MySQL GROUP_CONCAT - Separator
Submitted: 2017-01-14 10:18 UTC Modified: 2017-01-14 18:39 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sexavet94 at gmail dot com Assigned:
Status: Open Package: PDO MySQL
PHP Version: 7.0.14 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
6 + 28 = ?
Subscribe to this entry?

 
 [2017-01-14 10:18 UTC] 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());


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-14 18:39 UTC] 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>.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Oct 19 02:01:27 2019 UTC