php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17023 mysql_query: whitespace after ';' causes sql syntax error
Submitted: 2002-05-05 19:31 UTC Modified: 2002-05-06 01:12 UTC
From: kse at wp dot pl Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.2.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kse at wp dot pl
New email:
PHP Version: OS:

 

 [2002-05-05 19:31 UTC] kse at wp dot pl
Note the trailing whitespace in query:

<?
mysql_select_db("test");
mysql_query("select * from tab; ");
echo mysql_error();
?>

Result:

You have an error in your SQL syntax near '; ' at line 1

Again, note the trailing whitespace. Without it, it's OK.

It's particullary annoying with heredoc syntax.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-06 01:12 UTC] derick@php.net
Lose the ; and it will always work. The ; is not needed from mysql_query().

Not a bug -> Bogus.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 15:01:27 2025 UTC