#35565 [Opn->Fbk]: named :placeholders are not queried w/ MySQL

From: Date: Wed, 07 Dec 2005 09:59:51 +0000
Subject: #35565 [Opn->Fbk]: named :placeholders are not queried w/ MySQL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89877@lists.php.net to get a copy of this message
ID: 35565 Updated by: tony2001@php.net Reported By: capiCrimm at gmail dot com -Status: Open +Status: Feedback Bug Type: PDO related Operating System: GNU Debian Sarge PHP Version: 5CVS-2005-12-06 (snap) Previous Comments: ------------------------------------------------------------------------ [2005-12-07 04:22:47] capiCrimm at gmail dot com The CVS update did nothing. I tried downgrading to mysql 3.x and it didn't work. But upgrading to mysql5 did do the job. Seems weird, but maybe it's only >4.1.14? I'll try and compile PHP-CVS on another computer and see if the error is still occuring. ------------------------------------------------------------------------ [2005-12-06 22:48:54] iliaa@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip Seems to work in latest CVS using MySQL 4.1.14 ------------------------------------------------------------------------ [2005-12-06 19:15:10] capiCrimm at gmail dot com I'm running a .deb, ``mysql Ver 14.7 Distrib 4.1.12''. ------------------------------------------------------------------------ [2005-12-06 18:36:30] iliaa@php.net 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

« previous php.bugs (#89877) next »