<?php
// connect to data base
$mysql_link = mysql_connect('localhost' ,'CENSORD','CENSORD') or die("ERROR 001: Cannot connect to MySQL server. please contact system administration.");
if (!mysql_select_db('CENSORD', $mysql_link))
{
echo "Error 002: Could not select DataBase.";
}
$query = "INSERT INTO mail (mailid,to,from,subject,message) VALUES('1' ,'2','3','test','test')";
echo $query.'<BR>';
mysql_query($query)
or die(mysql_error());
?>
This is what i get on screen (the first line I print from $query)
INSERT INTO mail (mailid,to,from,subject,message) VALUES('1' ,'2','3','test','test')
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,from,subject,message) VALUES('1' ,'2','3','test','test')' at line 1