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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 19:01:31 2024 UTC