Jump to content

Message says 'Check SQL syntax' but I reckon its a PHP problem


mandrill

Recommended Posts

Here's my query:
[code]$query_Recordset1 = "SELECT * FROM jobs WHERE JobStatus = 'Collected and paid'";[/code]
Here's the error I get:
[code]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 '' at line 1[/code]

I can't see anything wrong with the SQL syntax and reckon its something to do with having ' and " right next to each other. Can anyone shed some light?
The single and double quotes next to each other shouldn't be a problem. Try this:

[code]$query_Recordset1 = "SELECT * FROM `jobs` WHERE `JobStatus` = 'Collected and paid'";[/code]

Assuming that your table name and column name are correct to begin with, the only thing I can suspect is that it does not like the column name 'JobStatus' because of the word status in it. Also, make sure the case of the column names is correct.
I can tell you that if it says you have a problem with your syntax, then there is something wrong with it. It doesn't make that stuff up. Status could be causing problems, and could also be causing issues, but it shouldn't because it is inside the ' ' , give the ` a shot and see if that works.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.