SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Query Problem

  1. #1
    - Michael - Bytecon's Avatar
    Join Date
    Mar 2004
    Location
    Ireland
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Query Problem

    Im having a little problem with this query:

    PHP Code:
    INSERT into page2(uid,1,2,3,4,5,6,7,8,8p1,8p2,8p3,8p4,8p5,9,10,10p1,10p2,11,12,12p1,12p2,13,13p1,13p2,13p3,13p4,13p5,14,14p1,14p2,15,15p1,15p2,16,17,18,18p1,18p2values ('$id','$_1','$_2','$_3','$_4','$_5','$_6','$_7','$_8','$_8p1','$_8p2','$_8p3','$_8p4','$_8p5','$_9','$_10','$_10p1','$_10p2','$_11','$_12','$_12p1','$_12p2','$_13','$_13p1','$_13p2','$_13p3','$_13p4','$_13p5','$_14','$_14p1','$_14p2','$_15','$_15p1','$_15p2','$_16','$_17','$_18','$_18p1','$_18p2'
    Code:
    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 '1,2,3,4,5,6,7,8,8p1,8p2,8p3,8p4,8p5,9,10,10p1,10p2,11,12,12p1,1
    Can anyone shed some light on it? I have an idea that it may be becaue the field names in the DB are integers.. would this be correct??

    Regards,
    Michael

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    yes, that is correct, you should ideally rename those columns, otherwise you will always have to code backticks around them

    insert into page2 (uid,`1`,`2`,`3`,`4`,`5`,...

    and i'm not even certain this will always work
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •