Jump to content


some mySQL help?

  • Please log in to reply
2 replies to this topic

#1 Biax

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 05 August 2006 - 11:09 AM

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?

#2 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 05 August 2006 - 11:25 AM

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`

Legend has it that reading the manual never killed anyone.
My site

#3 Biax

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 05 August 2006 - 12:30 PM

Thanks, that cleared it up. :)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users