Page 1 of 1

[SOLVED] Query problems

Posted: Sun Aug 15, 2004 7:24 am
by dwfait
I get this error:

Code: Select all

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' at line 1
On this query:

Code: Select all

$query = mysql_query("SELECT * FROM pm WHERE toid='$suser' AND read=0") or die(mysql_error());
ANy help to resovle this matter would be appreciated.

Posted: Sun Aug 15, 2004 7:27 am
by hawleyjr
What does your table look like?

Posted: Sun Aug 15, 2004 7:30 am
by dwfait
It has 7 fields, in this order:

id(primary) toid fromid date subject message read (default 0)

Posted: Sun Aug 15, 2004 7:54 am
by markl999
READ is a mysql reserved word. Either rename the column or backquote it, `read`

http://dev.mysql.com/doc/mysql/en/Reserved_words.html

Posted: Sun Aug 15, 2004 8:11 am
by dwfait
bah. again lol. Thanks mark.