I am using php to simply execute a mySQL query, but it just won't have it.
To make the table I used
CREATE TABLE `emails` ( `from` varchar(255), `owner` varchar(255), `subject` varchar(255), `message` text NOT NULL, `attach` varchar(255) default 'none', `unread` varchar(6) NOT NULL default 'unread', PRIMARY KEY (`id`) ) TYPE=MyISAM;
..to connect to the database I am using (in config.php):
mysql_connect('xxxxx','xxxxx','xxxxx');
mysql_select_db('xxxxx') or die(mysql_error());
.. and to execute the query I am using
<?php
ob_start();
require_once("config.php")
// then some stuff getting the messages
// setting variables - I assure you they are set
$query = mysql_query("INSERT INTO emails (from, owner, subject, message, attach, unread)VALUES('$from','$username','$subject','$message','$attach','unread')") or die(mysql_error());
?>
and the error I get 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 'from, owner, subject, message, attach, unread)VALUES('(removed)','webmail_test@k3o' at line 1
..webmail_test@k3o is not the full address, it should actually be webmail_test@k3o.co.uk.
Does anyone know what could be wrong?
