From: [EMAIL PROTECTED]
Operating system: Irrelevant
PHP version: 5.0.4
PHP Bug Type: Feature/Change Request
Bug description: Let PDO::query and PDO::exec accept $input_parameters
Description:
------------
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:
---------------
<?php
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:
<?php
$result = $pdo->prepare("SELECT name FROM test WHERE name LIKE ?");
$result->execute(array($_GET["name"]));
foreach ($result as $row) {
echo "$row[name]\n";
}
?>
--
Edit bug report at http://bugs.php.net/?id=33656&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33656&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33656&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33656&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33656&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33656&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33656&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33656&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33656&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33656&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33656&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33656&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33656&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33656&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33656&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33656&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33656&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33656&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33656&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33656&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33656&r=mysqlcfg