Results 1 to 3 of 3

Thread: Mysql Query Problems

  1. #1
    Join Date
    Dec 2008
    Posts
    11
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Mysql Query Problems

    Hi,

    Im not sure what im doing wrong. I am trying to run a query on my server which is usually fine however it is coming up with this message.
    "Error: 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, username) VALUES ('4','test','test','')' at line 1"
    The query is
    PHP Code:
     $query2 "INSERT INTO forum_threads (subcid, title, desc, username) VALUES ('".$c."','".$title."','".$desc."','".$user."')"
    Thanks in advance.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    DESC is a keyword in MySQL. Either name your column something else (recommended) or enclose the problematic column name in backticks (`desc`).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. The Following User Says Thank You to Twey For This Useful Post:

    simsonite (01-13-2009)

  4. #3
    Join Date
    Dec 2008
    Posts
    11
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much for your help

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •