From: capiCrimm at gmail dot com Operating system: GNU Debian Sarge PHP version: 5CVS-2005-12-06 (snap) PHP Bug Type: PDO related Bug description: named :placeholders are not queried w/ MySQL
Description: ------------ Using named and positional :placeholders in a PDO prepare statement result in an empty table in MySQL. Entering in the values into the prepare statement by hand does work, however, and when copying over the examples from the man to check myself I could get a nonsensical result(196864:327683) when using 5 for the values. I added a print in the code, but the values are also blank using mysql CLI and the result is the same using php CLI Reproduce code: --------------- <?php $conn = new PDO('mysql:dbname=testing;host=localhost;','root',''); ## CREATE TABLE tbTest(one char(4), two char(4)); $stmt = $conn->prepare("INSERT INTO tbTest(one,two) VALUES (:name , :value)"); $stmt->bindParam(':name', $name, PDO::PARAM_STR, 4); $stmt->bindParam(':value', $value, PDO::PARAM_STR, 4); $name = 'val1'; $value = 'val2'; $stmt->execute(); foreach( $conn->query("SELECT * FROM tbTest", PDO::FETCH_ASSOC) as $table ){ print " {$table['one']}:{$table['two']} "; } ?> Expected result: ---------------- val1:val2 Actual result: -------------- : -- Edit bug report at http://bugs.php.net/?id=35565&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35565&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35565&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35565&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35565&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35565&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35565&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35565&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35565&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35565&r=support Expected behavior: http://bugs.php.net/fix.php?id=35565&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35565&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35565&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35565&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35565&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35565&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35565&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35565&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35565&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35565&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35565&r=mysqlcfg