|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33656 Let PDO::query and PDO::exec accept $input_parameters
Submitted: 2005-07-12 12:04 UTC Modified: 2017-10-24 08:30 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: Assigned:
Status: Open Package: PDO related
PHP Version: 5.0.4 OS: Irrelevant
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:
Solve the problem:
39 - 10 = ?
Subscribe to this entry?

 [2005-07-12 12:04 UTC]
It will be nice if PDO::query() and PDO::exec() would accept $input_parameters. I like to take advantage of variable binding and I am querying a database with just one set of parameters quite often so the current interface is not very friendly for me.

Reproduce code:
foreach ($pdo->query("SELECT name FROM test WHERE name LIKE ?", array($_GET["name"])) as $row) {
   echo "$row[name]\n";

Expected result:
List of names.

Actual result:
Currently, this code must be used:
$result = $pdo->prepare("SELECT name FROM test WHERE name LIKE ?");
foreach ($result as $row) {
   echo "$row[name]\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 22:59 UTC]
-Package: Feature/Change Request +Package: PDO Core
 [2017-10-24 08:30 UTC]
-Package: PDO Core +Package: PDO related
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Sep 24 15:01:24 2023 UTC