SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict nabeel's Avatar
    Join Date
    Nov 2002
    Location
    in westchester county, ny
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stumped on an import (5.1.3 issue)

    Here's the query/error:

    Last 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 'range, weight, cruise) VALUES ( 'B733', 'B737-400', 'Boeing 737-400',' at line 3 ()]
    Query [5] -- [INSERT INTO phpvms_aircraft ( icao, name, fullname, registration, downloadlink, imagelink, range, weight, cruise) VALUES ( 'B733', 'B737-400', 'Boeing 737-400', 'N09802', '', '', '0', '0', '0')]
    Table structure:

    CREATE TABLE IF NOT EXISTS `phpvms_aircraft` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `icao` varchar(4) NOT NULL DEFAULT '',
    `name` varchar(12) NOT NULL DEFAULT '',
    `fullname` varchar(50) NOT NULL DEFAULT '',
    `registration` varchar(30) NOT NULL,
    `downloadlink` text NOT NULL,
    `imagelink` text NOT NULL,
    `range` varchar(15) NOT NULL DEFAULT '0',
    `weight` varchar(15) NOT NULL DEFAULT '0',
    `cruise` varchar(15) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB


    Not working on MySQL 5.1.30 (local test server, using xampp), but on my host 4.1 it does work. MySQL 5.0 seems okay too (from someone I asked who is running on 5.0).
    I've looked at reserved words, nothing that I can see, so I'm stumped. Can't spot any errors. Copy/pasting the query into my host's phpmyadmin runs it, locally gives the error.
    INSERT INTO phpvms_aircraft ( icao, name, fullname, registration, downloadlink, imagelink, range, weight, cruise) VALUES ( 'B733', 'B737-400', 'Boeing 737-400', 'N09802', '', '', '0', '0', '0')
    Any ideas? Thanks guys!

  2. #2
    SitePoint Addict nabeel's Avatar
    Join Date
    Nov 2002
    Location
    in westchester county, ny
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh, solved it.
    "Range" is a reserved word now in 5.1.x. Argh.

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did you try wrapping the table names in backticks? also i would try executing only that single line on your server and make sure the problem is isolated to that line.

    both things that probably won't work but it's worth a shot.

  4. #4
    SitePoint Addict nabeel's Avatar
    Join Date
    Nov 2002
    Location
    in westchester county, ny
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by XtrEM3 View Post
    did you try wrapping the table names in backticks? also i would try executing only that single line on your server and make sure the problem is isolated to that line.

    both things that probably won't work but it's worth a shot.
    Yep I had tried that, no luck. When I took the 'range' column out, it was ok. I was looking at the wrong reserved words list, I pulled one up for 5.1 and spotted it there. I hate it when they do such things

  5. #5
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i was pretty sure using backticks forced the string to be evaluated as a table name...regardless of it was using a reserved word.

    o well, glad you fixed it.

  6. #6
    SitePoint Addict nabeel's Avatar
    Join Date
    Nov 2002
    Location
    in westchester county, ny
    Posts
    203
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm it worked now when I tried it again.


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
  •