Thanks for the input, but that's not the problem now it seems.. after extensive testing, I can see that it's apparently due to some code before that which modifies the $text and $subject variables (it replaces text within those variables) and when it gets to that query, something in that text is not liked by the query?? Very odd... but commenting out that block of modification text makes it so that everything works. So I'll have to test this even more to see if I can find exactly the problem.
edit
ok, solved, but I'm still very confused by this. Here's what I had to change to fix it.. the difference between what works and what doesn't work:
shown in quote tags so that differences can be bolded:
works:
$result = mysql_query("INSERT into messages (sender_name, recipient_name, date, date_string, subject, text) VALUES ('$sender_name', '$recipient_name', '$date', '$date_string', '$subject', '$text')");
doesn't work (syntax error as described above):
$result = mysql_query("INSERT into messages (sender_name, recipient_name, date, date_string, subject, text, read, notified) VALUES ('$sender_name', '$recipient_name', '$date', '$date_string', '$subject', '$text', '0', '0')");
Well, at least it works now... I'll just have those two fields set to 0 as default instead of through this query...