php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56308 Semicolon detector needs to trim
Submitted: 2005-02-18 21:31 UTC Modified: 2005-02-19 16:54 UTC
From: sean at caedmon dot net Assigned:
Status: Not a bug Package: PDO_MYSQL (PECL)
PHP Version: 5.0.3 OS: Linux
Private report: No CVE-ID: None
 [2005-02-18 21:31 UTC] sean at caedmon dot net
Description:
------------
or at least that's my guess.

when calling $PDObj->exec()
"sql statement here;" works as expected
"sql statement here; " causes a MySQL syntax error
(note the trailing space)

Reproduce code:
---------------
$sql = "SELECT * FROM some_table; ";
if (FALSE === $res = $PDO->exec($sql)) {
  $err = $PDO->errorInfo();
  echo "Error: {$err[1]}: {$err[2]}\n";
}



Expected result:
----------------
no error

Actual result:
--------------
Error: 1064: You have an error in your SQL syntax near '; ' at line 1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-19 16:54 UTC] wez@php.net
Don't do that ;-)
The query is passed on to mysql, and it doesn't like what you said.
Not a PDO problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC