#38178 [Asn->Fbk]: Problem with parameter detection in queries (HY093)

From: Date: Tue, 01 Aug 2006 14:07:28 +0000
Subject: #38178 [Asn->Fbk]: Problem with parameter detection in queries (HY093)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100183@lists.php.net to get a copy of this message
ID: 38178 Updated by: iliaa@php.net Reported By: gerald at copix dot org -Status: Assigned +Status: Feedback Bug Type: PDO related Operating System: Windows PHP Version: 5.1.4 Assigned To: wez New Comment: What database driver are you using? Previous Comments: ------------------------------------------------------------------------ [2006-07-21 16:08:00] gerald at copix dot org 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 this bug report at http://bugs.php.net/?id=38178&edit=1

« previous php.bugs (#100183) next »