#38178 [NEW]: Problem with parameter detection in queries (HY093)

From: Date: Fri, 21 Jul 2006 16:08:01 +0000
Subject: #38178 [NEW]: Problem with parameter detection in queries (HY093)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99715@lists.php.net to get a copy of this message
From: gerald at copix dot org Operating system: Windows PHP version: 5.1.4 PHP Bug Type: PDO related Bug description: Problem with parameter detection in queries (HY093) Description: ------------ Using PDO, a simple insert query does not work with "prepare / execute" but works fine using "exec" This exact query does work correctly if I remove the text '\r\n' at its end. The query is : 'INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\r\n\')' It may be related to the following bugs : #36923 & #37646 Reproduce code: --------------- //FOLLOWING DOES NOT WORK $stmt = $pdo->prepare ('INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\r\n\')'); if (! $stmt->execute ()){ print_r ($stmt->errorInfo ());//contains Array ( [0] => HY093 ) } //FOLLOWING CODE IS OK (using exec) if (! $pdo->exec ('INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\r\n\')')){ print_r ($pdo->errorInfo ()); } //FOLLOWING CODE IS OK (removed \r\n at the end of the query) $stmt = $pdo->prepare ('INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\')'); $stmt->execute ();//OK Expected result: ---------------- PDO should insert the value 'xml:lang="fr" lang="fr">\r\n' in the myTable table, wish is CREATE TABLE myTable ( test VARCHAR( 255 ) NOT NULL ) Actual result: -------------- Warning: PDOStatement::execute() [function.PDOStatement-execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in C:\Program Files\wamp\www\test_3\www\index.php on line 40 -- Edit bug report at http://bugs.php.net/?id=38178&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38178&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38178&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38178&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38178&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38178&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38178&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38178&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38178&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38178&r=support Expected behavior: http://bugs.php.net/fix.php?id=38178&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38178&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38178&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38178&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38178&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38178&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38178&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38178&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38178&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38178&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38178&r=mysqlcfg

« previous php.bugs (#99715) next »