|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: todd at bluecliff dot net
New email:
PHP Version: OS:


 [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: Wed Dec 08 15:03:41 2021 UTC