brophi Posted October 30, 2007 Share Posted October 30, 2007 Server version: 5.0.45-community-nt The brocken code: $to = mysql_real_escape_string($_POST['to']); $text = mysql_real_escape_string($_POST['text']); $from = mysql_real_escape_string($_SESSION["sessioname"]); mysql_query("INSERT INTO mail (to, from, text, datetime) VALUES ('$to', '$from', '$text', NULL)") The mysql_error(): 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, text, datetime VALUES ('Brophi', 'Brophi', 'Test', NULL)' at line 1 The 'mail' table: CREATE TABLE `mail` (\n `to` text collate latin1_general_ci NOT NULL,\n `from` text collate latin1_general_ci NOT NULL,\n `text` text collate latin1_general_ci NOT NULL,\n `datetime` timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci Can someone please help, I keep getting this error, although i havnt ttried much cause i dont know much about mysql syntax, im sorry if this post is hard to read, but please help Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted October 30, 2007 Share Posted October 30, 2007 INSERT INTO mail ( `to` , `from` , `text` , `datetime` ) VALUES ( '$to', '$from', '$text', NOW( ) ); You can use NULL, in place of NOW() Quote Link to comment Share on other sites More sharing options...
brophi Posted October 30, 2007 Author Share Posted October 30, 2007 thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.