ID: 36798
Updated by: [EMAIL PROTECTED]
Reported By: albert at jool dot nl
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Debian Sarge
PHP Version: 5.1.2
New Comment:
What is the charset of the server/connection?
Previous Comments:
------------------------------------------------------------------------
[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] [EMAIL PROTECTED]
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.
------------------------------------------------------------------------
[2006-03-20 15:50:38] albert at jool dot nl
Description:
------------
Create a PDO_MYSQL connection ($db in the example code). Prepare a
query with high ascii values between single quotes (update queries are
often affected) and one or more named parameters. Execute the query.
Reproduce code:
---------------
$query = "
SELECT 'ï' as test
FROM test
WHERE id = :id";
$stm = $db->prepare($query);
$stm->execute(array(":id" => 1));
Expected result:
----------------
No errors, query is correct when executed directly under mysql.
Actual result:
--------------
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ':id' at line 3
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36798&edit=1