|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34861 No documented way for PDO to escape a colon
Submitted: 2005-10-13 21:21 UTC Modified: 2005-10-14 20:43 UTC
From: todd at bluecliff dot net Assigned:
Status: Closed Package: PDO related
PHP Version: 5.0.5 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
46 - 1 = ?
Subscribe to this entry?

 [2005-10-13 21:21 UTC] todd at bluecliff dot net
There is no documented way to escape a colon in PDO.  I understand that there may be a new patch to make this optional, however, I would not like to use the bindParam function, I would just like to escape it outright.  no number of backslashes seem to work.  This bug hints at the problem, however, there is no note on how to escape a : (colon):

Reproduce code:
// basically just an update on a time field
$sql_query_str = "UPDATE _sif_message_queue SET msg_time_remote='10:53:00' WHERE message_queue_id=".$this->message_queue_id;
			$stmt = $appconnection->prepare($sql_query_str);

Expected result:
Query executes successfully

Actual result:
SQLSTATE[HY093]: Invalid parameter number: no parameters were bound


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-14 13:41 UTC]
Please try using this CVS snapshot:
For Windows:

Works perfectly here:
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$stmt = $pdo->prepare("UPDATE test SET a = '10:53:00'");
 [2005-10-14 19:51 UTC] todd at bluecliff dot net
I will try the latest snapshot, but I am also connecting against a Postgresql 8 database with a column type of "TIME", I don't know if that makes a difference in your testing.
 [2005-10-14 20:43 UTC]
This was fixed in 5.1 a while back.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 21:03:34 2021 UTC