ID: 35565 User updated by: capiCrimm at gmail dot com Reported By: capiCrimm at gmail dot com -Status: Feedback +Status: Open Bug Type: PDO related Operating System: GNU Debian Sarge PHP Version: 5CVS-2005-12-06 (snap) New Comment:
I'm running a .deb, ``mysql Ver 14.7 Distrib 4.1.12''. Previous Comments: ------------------------------------------------------------------------ [2005-12-06 18:36:30] [EMAIL PROTECTED] What version of MySQL are you using? ------------------------------------------------------------------------ [2005-12-06 06:17:30] capiCrimm at gmail dot com 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 this bug report at http://bugs.php.net/?id=35565&edit=1