Jump to content

some mySQL help?


Biax

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.