Bug #52489 [Bgs]: PDOStatement::execute() errors when querying for backslash and question mark

From: Date: Thu, 29 Jul 2010 16:16:31 +0000
Subject: Bug #52489 [Bgs]: PDOStatement::execute() errors when querying for backslash and question mark
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152944@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52489&edit=1 ID: 52489 User updated by: untold69 at hotmail dot com Reported by: untold69 at hotmail dot com Summary: PDOStatement::execute() errors when querying for backslash and question mark Status: Bogus Type: Bug Package: PDO related Operating System: Windows 7 PHP Version: 5.2.14 Block user comment: N New Comment: The question mark is surrounded by quotes and so should be used as a literal value to query the table column, not as a parameter placeholder. The exact same SQL statement executes fine when using PDO::query, e.g. $result = $pdo->query("SELECT * FROM table WHERE column1 = '\' AND column2 = '?'"); Previous Comments: ------------------------------------------------------------------------ [2010-07-29 17:52:08] degeberg@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Question marks are parameter placeholders. ------------------------------------------------------------------------ [2010-07-29 17:48:29] untold69 at hotmail dot com Description: ------------ Using PDO to prepare and then execute a statement that queries for a backslash and then a question mark sequentially in two columns generates a warning. Test script: --------------- $pdo = new PDO("mssql:dbname=mydb;host=myhost", "myuser", "mypassword"); $stmt = $pdo->prepare("SELECT * FROM table WHERE column1 = '\' AND column2 = '?'"); $result = $stmt->execute(); Expected result: ---------------- Array or false. Actual result: -------------- Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52489&edit=1

« previous php.bugs (#152944) next »