#36798 [Fbk->Opn]: mysql error when using named parameters in a query with high ascii
| From: | albert at jool dot nl | Date: | Wed, 22 Mar 2006 18:53:10 +0000 |
| Subject: | #36798 [Fbk->Opn]: mysql error when using named parameters in a query with high ascii | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94770@lists.php.net to get a copy of this message | ||
ID: 36798
User updated by: albert at jool dot nl
Reported By: albert at jool dot nl
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Debian Sarge
PHP Version: 5.1.2
New Comment:
Charset of the connection is default ISO-8859-1 (you need to explicitly
set another charset in the dsn), and the charset of any mysql table used
is default latin1 - if any solution requires changing any of these
settings, consider changing PHP first :).
Anyhow, notice that the query _parsing_ fails, not the query itself.
The double-quote fix isn't working btw - the error just didn't show up
anymore as output (which is also strange!).
Previous Comments:
------------------------------------------------------------------------
[2006-03-21 15:41:47] iliaa@php.net
What is the charset of the server/connection?
------------------------------------------------------------------------
[2006-03-20 16:53:28] albert at jool dot nl
oops, changed the summary
------------------------------------------------------------------------
[2006-03-20 16:52:34] albert at jool dot nl
Tried the snapshot, and the problem still exists. Perhaps you aren't
seeing the error because you need to explicitly set exception
handling:
$db = new PDO("mysql:host=$dbHost;dbname=$dbName", $dbUser, $dbPass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
[.. and then the code ..]
------------------------------------------------------------------------
[2006-03-20 15:59:03] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
Can't reproduce.
------------------------------------------------------------------------
[2006-03-20 15:54:34] albert at jool dot nl
Changing the single quotes in the query to double seems to fix the
problem.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/36798
--
Edit this bug report at http://bugs.php.net/?id=36798&edit=1