Comments on SilentDeathWithABigNose: After all that! Something as simple as that and I didn't see it… A big D'OH!

I’m trying to figure out this problem…
Using that fckeditor you mentioned, everything is in place but I get this error when trying to save to DB

This is the error 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 ‘by)VALUES(NOW(),, )’ at line 1

This is the code…


// Connect to server and select databse.
mysql_connect(”$host”, “$username”, “$password”)or die(“cannot connect”);
mysql_select_db(”$db_name”)or die(“cannot select DB”);

$submit1 = $_post[‘submit1’];
$sValue = stripslashes( $_POST[‘FCKeditor1’] ) ;

$sql=“INSERT INTO $tbl_name(time, news, by)VALUES(NOW(),’$sValue’, ’$submit1’)”;
mysql_query($sql)or die (mysql_error());


Any ideas?

The Creator 2007-09-03 23:58 UTC

The first thing that strikes me is that you’re using “by” at a column name. That’s got to be a reserved word, surely? As in “….order by…”, “…group by….”, etc.

Change that field name :)

GreyWulf 2007-09-06 09:12 UTC

After all that!
Something as simple as that and I didn’t see it…
A big D’OH!

The Creator 2007-09-06 20:29 UTC

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.