#35565 [Com]: named :placeholders are not queried w/ MySQL
ID: 35565
Comment by: leigh at eon dot com dot au
Reported By: capiCrimm at gmail dot com
Status: No Feedback
Bug Type: PDO related
Operating System: GNU Debian Sarge
PHP Version: 5CVS-2005-12-06 (snap)
New Comment:
I have encountered this problem using PHP 5.1.2 with MySQL 4.1.12.
However, MySQL 5.0.18 returns the expected results.
I was unable to install the latest CVS copy of PHP 5.1, but might try
again later when I have more time.
<?php
$id = '1';
$conn = new PDO('mysql:dbname=test;host=localhost;','root','worksql');
# CREATE TABLE testtable ( test_id INT NOT NULL ,test_data
VARCHAR( 128 ) NOT NULL );
# INSERT INTO testtable ( test_id , test_data ) VALUES (
'1',
'test data 1' ), ( '2', 'test data 2' );
$query = $conn->prepare("SELECT * FROM testtable WHERE test_id=?");
$query->execute(array($id));
$results = $query->fetchAll(PDO::FETCH_ASSOC);
var_dump($results);
?>
MySQL 4.1.12 returns:
array(0) {
}
MySQL 5.0.18 returns:
array(1) {
[0]=>
array(2) {
["test_id"]=>
string(1) "1"
["test_data"]=>
string(11) "test data 1"
}
}
Previous Comments:
------------------------------------------------------------------------
[2005-12-15 01:00:04] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[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?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35565
--
Edit this bug report at http://bugs.php.net/?id=35565&edit=1
Thread (9 messages)