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

From: Date: Tue, 06 Dec 2005 21:48:56 +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-89852@lists.php.net to get a copy of this message
 ID:               35565
 Updated by:       iliaa@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)
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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


Thread (9 messages)

« previous php.bugs (#89852) next »