I am getting a syntax error with the following PHP statement:
mysql_query("INSERT INTO table1 (to, from, msg, field, date)
VALUES ('TEST_TO', 'TEST_FROM', 'TEST_MSG', 'TEST_FIELD', 'TEST_DATE')");
The returned error is:
You have an error in your SQL syntax.
What is the problem with the code?
toandfromare reserved words. You need to quote them (with backticks since they are field names). (It is worth getting into the habit of always quoting field names rather then trying to remember which are reserved).