#35565 [Fbk->Opn]: named :placeholders are not queried w/ MySQL
| From: | capiCrimm at gmail dot com | Date: | Wed, 07 Dec 2005 03:22:49 +0000 |
| Subject: | #35565 [Fbk->Opn]: named :placeholders are not queried w/ MySQL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89867@lists.php.net to get a copy of this message | ||
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:
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.
Previous Comments:
------------------------------------------------------------------------
[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