Yeah your SQL looks like this when it is being read by the MySQL server:
UPDATE tbl_intmsg SET time = 26, 2009, 2:28 pm, by = shamil.nunhuck
AND content = Test message!
How is MySQL to figure out what is what in that statement?
Imagine, for instance, that you set your $content to '0 WHERE dummy = true'. Then your SQL would look like this:
UPDATE tbl_intmsg SET time = 26, 2009, 2:28 pm, by = shamil.nunhuck
AND content = 0 WHERE dummy = true
Do you see the problem? How is SQL to figure out what is your data, and what is SQL keywords?
The answer is: quotes!
Your SQL should look like this:
UPDATE tbl_intmsg SET time = '26, 2009, 2:28 pm', by = 'shamil.nunhuck'
AND content = 'Test message!'
Your PHP SQL-query string could look like this:
$q="UPDATE tbl_intmsg SET time = '$dt', by = '$by' AND content = '$content'";
(Note that PHP parses double-quote strings for variables and replaces them with their value. Also note that you should use the above mentioned function
mysql_real_escape_string($var)
to sanitize your data before putting it into MySQL. Here's the link that mechler couldn't post: php.net/mysql-real-escape-string)
Cheers!
/0