Error in SQL syntax
Posted: Fri May 13, 2011 12:41 am
I am a beginner when it comes to PHP so please bare with me.
Now, I've looked it over and to me it seems right. I've done both of those plenty of times before and they worked flawlessly but for some reason they don't want to work now.
What's wrong with it?
$query = mysql_query("SELECT * FROM send_pm WHERE to = '$_SESSION[username]'") or die (mysql_error());Now for some reason I keep getting this 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 'to = 'test'' at line 1
$insert = mysql_query("INSERT INTO send_pm (to, subject, message) VALUES ('$_POST[to]', '$_POST[subject]', '$_POST[message]')") or die (mysql_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 'to, subject, message) VALUES ('test', 'test', 'test')' at line 1
Now, I've looked it over and to me it seems right. I've done both of those plenty of times before and they worked flawlessly but for some reason they don't want to work now.
What's wrong with it?