I tried that but that didn't work. It still say it has to do with the AND and OR, but I don't know why they would cause an error.
This statement works fine.
$result = mysql_query("SELECT * FROM members WHERE name = '$username' ",$db);
This statement doesn't work.
$result = mysql_query("SELECT count(*) FROM messages WHERE (to = $username) OR (to = 'Everybody') AND (type = 'New'),$db);
I got the same error with that sql query.