lpeek
05-15-2008, 10:24 AM
Hey Hey,
having quite a bit of trouble with some code.
Its all set up correctly, and should work, but i keep getting a syntax error.
heres the code in question:
if ($cmd=="commentpost")
{
$SCREEN_ID = $sid;
$MY_ID = $_SESSION['user_id'];
$BODY = $_POST['comment'];
$cur_date = time();
$BODY = addslashes(nl2br($BODY));
$sql = mysql_query("INSERT INTO `screenshot_comments` (screen_id, user_id, timestamp, body, read) VALUES ('$SCREEN_ID','$MY_ID','$cur_date','$BODY','0')") or die(mysql_error());
$comment_posted = true;
}
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 'read) VALUES ('57','3','1210842919',abcde' at line 1
ive checked and double checked my database and all the columns are named correctly etc.
Any ideas?
having quite a bit of trouble with some code.
Its all set up correctly, and should work, but i keep getting a syntax error.
heres the code in question:
if ($cmd=="commentpost")
{
$SCREEN_ID = $sid;
$MY_ID = $_SESSION['user_id'];
$BODY = $_POST['comment'];
$cur_date = time();
$BODY = addslashes(nl2br($BODY));
$sql = mysql_query("INSERT INTO `screenshot_comments` (screen_id, user_id, timestamp, body, read) VALUES ('$SCREEN_ID','$MY_ID','$cur_date','$BODY','0')") or die(mysql_error());
$comment_posted = true;
}
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 'read) VALUES ('57','3','1210842919',abcde' at line 1
ive checked and double checked my database and all the columns are named correctly etc.
Any ideas?