Jump to content

mysql error


garydt

Recommended Posts

Everytime i submit the form i get-

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 ''test', ''' at line 1

Any ideas?

Thanks


if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$subj = $_POST['subject'];
$s = preg_replace ($search, $replace, $subj);
$text = $_POST['post'];
$p = preg_replace ($search, $replace, $text);
$dt = date('d-M-Y');
mysql_select_db($database_elvisdb, $elvisdb);
  $insertSQL = sprintf("INSERT INTO forum (topic, message) ('" . mysql_real_escape_string($s) . "', '" . mysql_real_escape_string($p) . "'");

  mysql_select_db($database_elvisdb, $elvisdb);
  $Result1 = mysql_query($insertSQL, $elvisdb) or die(mysql_error());
}

Link to comment
https://forums.phpfreaks.com/topic/71677-mysql-error/
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.