Biax Posted August 5, 2006 Share Posted August 5, 2006 Hello, I've been working on an "add download" form for my website, where I enter in information about a download, and then it adds it into a mySQL table. But there's something wrong with my mySQL syntax. My insertion line is:$sql = mysql_query("INSERT INTO downloads (catagory, title, url, desc, images, date) VALUES($mod_cat, $mod_name, $mod_url, $mod_desc, $mod_imgs, now())") or die (mysql_error());And 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 'desc, images, date) VALUES(1, test, test, This is a test, http://www.test.com/bl' at line 1"I don't really have a good grasp of mySQL just yet, can anyone spot the incorrect syntax? Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 5, 2006 Share Posted August 5, 2006 DESC is a reserved word and should not be used as a field name. You should change it to something that is not a MySQL reserved word. Alternatively, you can change the query so that desc is enclosed with backticks - `desc`http://www.htmlite.com/mysql002a.php Quote Link to comment Share on other sites More sharing options...
Biax Posted August 5, 2006 Author Share Posted August 5, 2006 Thanks, that cleared it up. :) 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.