Jump to content

[SOLVED] INSERT INTO, HELP!


brophi

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/75326-solved-insert-into-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.