mandrill Posted November 3, 2006 Share Posted November 3, 2006 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? Link to comment https://forums.phpfreaks.com/topic/26056-message-says-check-sql-syntax-but-i-reckon-its-a-php-problem/ Share on other sites More sharing options...
Psycho Posted November 3, 2006 Share Posted November 3, 2006 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. Link to comment https://forums.phpfreaks.com/topic/26056-message-says-check-sql-syntax-but-i-reckon-its-a-php-problem/#findComment-119125 Share on other sites More sharing options...
jcbarr Posted November 3, 2006 Share Posted November 3, 2006 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. Link to comment https://forums.phpfreaks.com/topic/26056-message-says-check-sql-syntax-but-i-reckon-its-a-php-problem/#findComment-119133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.