Jump to content

Archived

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

Biax

some mySQL help?

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.