I'm getting an error here somewhere $username = $_SESSION['username']; //Get Mail $mail = mysql_query("SELECT * FROM messages WHERE to = '".$username."'") or die(mysql_error()); $countMail = mysql_num_rows($mail); PHP: However if I change the text messages to users and "to" to username it'll work fine Thanks
The error message I'am getting is 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 'to='Admin'' at line 1 Code (markup):
As a general rule, I always wrap my field names in ` characters. eg, `field_name` - that way you never get that kind of issue, and I find it helps me read my mySQL syntax a bit better.