0

I have a very simple select statement:

$sqllinks = mysql_query("SELECT * FROM notif WHERE mem_id = '$logOptions_id' AND read = '0' ORDER BY date") or die (mysql_error()); // query the member
$numofnotif = mysql_num_rows($sqllinks);

however i constantly get the error :

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 'read = '0' ORDER BY date' at line 1

I have tried everything that I can think of to try to get this to work but somehow it doesn't.

Thank you.

idwes7
  • 31
  • 5

1 Answers1

4

READ is a reserved word. Quote it in backticks:

SELECT   *
FROM     notif
WHERE    mem_id = '$logOptions_id' AND `read` = '0'
ORDER BY date
eggyal
  • 122,705
  • 18
  • 212
  • 237