#1064 - You have an error in your SQL syntax; (newbie)

Discussion in 'MySQL' started by mastamindz, May 22, 2012.

  1. #1
    I am very new to mySQL, and have searched google and the boards for the answer to this, but due to my newbie'ness I am unable to get to this working. Any help on this would be appreciated!

    #1064 - You have an error in your SQL syntax;

    mySQL version: 4.1.22

    
    
    CREATE TABLE `admin` (
      `admin_id` int(11) NOT NULL AUTO_INCREMENT,
      `admin_username` varchar(255) NOT NULL DEFAULT '',
      `admin_password` varchar(255) NOT NULL DEFAULT '',
      `admin_name` varchar(255) NOT NULL DEFAULT '',
      `admin_email` varchar(255) NOT NULL DEFAULT '',
      PRIMARY KEY (`admin_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
    
    
    
    INSERT INTO `admin` VALUES (1, 'admin', 'test', 'admin', 'test@test.com');
    
    
    
    CREATE TABLE `canada_prov` (
      `cp_id` int(11) NOT NULL AUTO_INCREMENT,
      `cp_name` varchar(255) NOT NULL,
      PRIMARY KEY (`cp_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
    
    
    
    INSERT INTO `canada_prov` VALUES (1, 'Alberta');
    INSERT INTO `canada_prov` VALUES (2, 'British Columbia');
    INSERT INTO `canada_prov` VALUES (3, 'Manitoba');
    INSERT INTO `canada_prov` VALUES (4, 'New Brunswick');
    INSERT INTO `canada_prov` VALUES (5, 'Newfoundland and Labrador');
    INSERT INTO `canada_prov` VALUES (6, 'Nova Scotia');
    INSERT INTO `canada_prov` VALUES (7, 'Ontario');
    INSERT INTO `canada_prov` VALUES (8, 'Prince Edward Island');
    INSERT INTO `canada_prov` VALUES (9, 'Quebec');
    INSERT INTO `canada_prov` VALUES (10, 'Saskatchewan');
    
    
    
    CREATE TABLE `cart` (
      `cart_id` int(11) NOT NULL AUTO_INCREMENT,
      `cart_l_id` int(11) DEFAULT NULL,
      `cart_date` int(11) NOT NULL,
      `cart_status` int(11) DEFAULT '0',
      `cart_msg` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
      `cart_total` varchar(255) DEFAULT NULL,
      `cart_reciept` longtext NOT NULL,
      PRIMARY KEY (`cart_id`)
    )
    
    
    
    
    
    CREATE TABLE `cart_items` (
      `ci_id` int(11) NOT NULL AUTO_INCREMENT,
      `ci_cart_id` int(11) NOT NULL,
      `ci_prod_id` int(11) DEFAULT NULL,
      `ci_qty` int(11) NOT NULL,
      `ci_prod_price` double NOT NULL,
      `ci_total` double NOT NULL,
      PRIMARY KEY (`ci_id`),
      KEY `ci_cart_id` (`ci_cart_id`)
    ) 
    
    
    
    
    
    CREATE TABLE `category` (
      `cat_id` int(11) NOT NULL AUTO_INCREMENT,
      `cat_name` varchar(255) NOT NULL,
      `cat_url` varchar(255) NOT NULL,
      `cat_parent_id` int(11) NOT NULL,
      `cat_desc` longtext NOT NULL,
      PRIMARY KEY (`cat_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
    
    
    
    INSERT INTO `category` VALUES (1, 'Cleaners, Soaps, Detergent', 'cleaners-soaps-detergent', 0, '');
    INSERT INTO `category` VALUES (2, 'Garbage Bags', 'garbage-bags', 0, '');
    INSERT INTO `category` VALUES (3, 'Gloves', 'gloves', 0, '');
    INSERT INTO `category` VALUES (4, 'Miscellaneous', 'miscellaneous', 0, '');
    INSERT INTO `category` VALUES (5, 'Paper Products', 'paper-products', 0, '');
    INSERT INTO `category` VALUES (6, 'Rags & Sponges', 'rags--sponges', 0, '');
    INSERT INTO `category` VALUES (7, 'Wet Mopping', 'wet-mopping', 0, '');
    
    
    
    CREATE TABLE `forgot_pass` (
      `fp_id` int(11) NOT NULL AUTO_INCREMENT,
      `fp_l_id` int(11) NOT NULL,
      `fp_key` varchar(255) NOT NULL,
      `fp_date` int(11) NOT NULL,
      `fp_valid` int(11) NOT NULL DEFAULT '0',
      PRIMARY KEY (`fp_id`)
    ) 
    
     
    
    
    
    CREATE TABLE `login` (
      `l_id` int(11) NOT NULL AUTO_INCREMENT,
      `l_username` varchar(255) NOT NULL,
      `l_name` varchar(255) NOT NULL,
      `l_password` varchar(255) NOT NULL,
      `l_email` varchar(255) NOT NULL,
      `l_bill_comp` varchar(255) NOT NULL,
      `l_bill_address` varchar(255) NOT NULL,
      `l_bill_city` varchar(255) NOT NULL,
      `l_bill_prov` varchar(255) DEFAULT NULL,
      `l_bill_zip` varchar(255) NOT NULL,
      `l_ship_comp` varchar(255) NOT NULL,
      `l_ship_address` varchar(255) NOT NULL,
      `l_ship_city` varchar(255) NOT NULL,
      `l_ship_prov` varchar(255) DEFAULT NULL,
      `l_ship_zip` varchar(255) NOT NULL,
      PRIMARY KEY (`l_id`)
    )
    
    
    
    
     
    
    CREATE TABLE `products` (
      `prod_id` int(11) NOT NULL AUTO_INCREMENT,
      `prod_cat_id` int(11) DEFAULT NULL,
      `prod_name` varchar(255) DEFAULT NULL,
      `prod_desc` longtext,
      `prod_unit` varchar(255) NOT NULL,
      `prod_price` varchar(255) DEFAULT NULL,
      `prod_url` varchar(255) NOT NULL,
      `prod_supp_email` varchar(255) NOT NULL,
      `prod_ship_charge` varchar(255) NOT NULL DEFAULT '0',
      PRIMARY KEY (`prod_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
    
    
    
    INSERT INTO `products` VALUES (1, 1, 'I106-4L', 'Clean Plus Glass Cleaner - 4L', 'Individual (1)', '5.55', 'i106-4l', 't@test.com', '0');
    INSERT INTO `products` VALUES (2, 1, 'F100 - 4L', 'Cleaner - 4L Neutral Detergent', 'Individual (1)', '13.11', 'f100---4l', 't@test.com', '0');
    INSERT INTO `products` VALUES (3, 1, 'F102 - 4L', 'Cleaner - Quick Strip 4L', 'Individual (1)', '19.75', 'f102---4l', 'test12@test.com', '0');
    INSERT INTO `products` VALUES (4, 1, 'B102 - 4L', 'Formula 333 - Concentrated Disinfectant 4L', 'Individual (1)', '13.52', 'b102---4l', 't@test.com', '0');
    INSERT INTO `products` VALUES (5, 1, 'L203 - 20', 'Laundry - Special Blue Laundry Compound 20kg', 'Individual (1)', '57', 'l203---20', 't@test.com', '23');
    INSERT INTO `products` VALUES (6, 1, '50814', 'Lysol Toilet Bowl Cleaner', 'Individual (1)', '4', '50814', 'test@test.com', '2');
    INSERT INTO `products` VALUES (7, 1, 'GaterWrap21', 'Soap - Ora Bar Soap 21gm (500/case)', 'Individual (1)', '80.85', 'gaterwrap21', 'test12@test.com', '20');
    INSERT INTO `products` VALUES (8, 1, 'TS290W', 'Spray Bottles c/w whimis 32oz', 'Individual (1)', '1.19', 'ts290w', 'test@test.com', '1');
    INSERT INTO `products` VALUES (10, 2, '20x22x500BLK', 'Garbage Bags - 20x22x500 Black', 'Individual (1)', '22.13', '20x22x500blk', '', '0');
    INSERT INTO `products` VALUES (11, 2, '20x22x500CLR', 'Garbage Bags - 20x22x500 CLR', 'Individual (1)', '24.30', '20x22x500clr', '', '0');
    INSERT INTO `products` VALUES (12, 2, '35x50x100', 'Garbage Bags - Black garbage bags Extra Strong', 'Individual (1)', '24.80', '35x50x100', '', '0');
    INSERT INTO `products` VALUES (13, 2, '35x50CLR', 'Garbage Bags - Extra Strong Clear', 'Individual (1)', '27.70', '35x50clr', '', '0');
    INSERT INTO `products` VALUES (14, 3, 'CS BLL', 'Gloves - Nitrile Lg Disposable Gloves Raven', 'Individual (1)', '150.00', 'cs-bll', '', '0');
    INSERT INTO `products` VALUES (15, 3, 'CS BLM', 'Gloves - Nitrile Med Disposable Gloves Blk Raven', 'Individual (1)', '150.00', 'cs-blm', '', '0');
    INSERT INTO `products` VALUES (16, 3, 'CS BLXL', 'Gloves - Nitrile XLG Disposable Gloves Blk Raven', 'Individual (1)', '150.00', 'cs-blxl', '', '0');
    INSERT INTO `products` VALUES (17, 4, '054450004', 'Ice Melt Polar Plus Ice Melt - 20 kg', 'Individual (1)', '12.04', '054450004', '', '0');
    INSERT INTO `products` VALUES (18, 4, '8210', 'Masks - Dust Masks - 3M N95 (20/Box)', 'Individual (1)', '21.31', '8210', '', '0');
    INSERT INTO `products` VALUES (19, 4, 'G08143', 'Next Step 2 Base Coat', 'Individual (1)', '118.70', 'g08143', '', '0');
    INSERT INTO `products` VALUES (20, 4, 'G08343', 'Next Step 3 Succeed 90 L.M. 2-10L', 'Individual (1)', '116.40', 'g08343', '', '0');
    INSERT INTO `products` VALUES (21, 4, 'B06701', 'Red Sanitizer Pails - 5L', 'Individual (1)', '5.55', 'b06701', '', '0');
    INSERT INTO `products` VALUES (22, 4, 'TS5911', 'Trigger Sprayer Red/Wt', 'Individual (1)', '1.41', 'ts5911', '', '0');
    INSERT INTO `products` VALUES (23, 5, '08300', 'Facial Tissue White Swan 2 Ply', 'Individual (1)', '36.52', '08300', '', '0');
    INSERT INTO `products` VALUES (24, 5, '12-12-02', 'Paper Towels - 2 Ply C/F Towels (6 Rolls x 610'')', 'Individual (1)', '43.00', '12-12-02', '', '0');
    INSERT INTO `products` VALUES (25, 5, 'RK350', 'Paper Towels 8" Tork Roll (12 rolls x 350'')', 'Individual (1)', '36.66', 'rk350', '', '0');
    INSERT INTO `products` VALUES (26, 5, '75004353', 'Toilet Tissue - P/S 2 Ply Single Roll White 48/cs', 'Individual (1)', '40.12', '75004353', '', '0');
    INSERT INTO `products` VALUES (27, 5, '5144', 'Toilet Tissue - White Swan 2 ply Individual Wrap', 'Individual (1)', '40.12', '5144', '', '0');
    INSERT INTO `products` VALUES (28, 5, '5134', 'Toilet Tissue - White Swan 2 Ply TT 48x429', 'Individual (1)', '40.12', '5134', '', '0');
    INSERT INTO `products` VALUES (29, 6, 'R130-Bl', 'Micro Fiber Cloth Blue', 'Individual (1)', '2.50', 'r130-bl', '', '0');
    INSERT INTO `products` VALUES (30, 6, 'R130-Grn', 'Micro Fiber Cloth Green', 'Individual (1)', '2.50', 'r130-grn', '', '0');
    INSERT INTO `products` VALUES (31, 6, 'R130-Wt', 'Micro Fiber Cloth White', 'Individual (1)', '2.50', 'r130-wt', '', '0');
    INSERT INTO `products` VALUES (32, 7, 'MPLMM', 'Mop Head Medium Looper', 'Individual (1)', '10.49', 'mplmm', '', '0');
    INSERT INTO `products` VALUES (33, 7, 'VQW', 'Vileda Mop Pail w Wringer', 'Individual (1)', '14.69', 'vqw', '', '0');
    INSERT INTO `products` VALUES (34, 7, 'VMR', 'Vileda Mop Refill', 'Individual (1)', '10.49', 'vmr', '', '0');
    INSERT INTO `products` VALUES (35, 7, 'VTM', 'Vileda Twist Mop', 'Individual (1)', '16.49', 'vtm', '', '0');
    
    
    
    CREATE TABLE `status` (
      `st_id` int(11) NOT NULL AUTO_INCREMENT,
      `st_name` varchar(255) NOT NULL,
      `st_color` varchar(255) NOT NULL,
      PRIMARY KEY (`st_id`)
    ) 
    
     
    
    
    
    CREATE TABLE `uploads` (
      `up_id` int(11) NOT NULL AUTO_INCREMENT,
      `up_s_id` int(11) DEFAULT NULL,
      `up_s_type` varchar(100) DEFAULT NULL,
      `up_fname` varchar(100) DEFAULT NULL,
      `up_oname` varchar(100) DEFAULT NULL,
      `up_ext` varchar(100) DEFAULT NULL,
      `up_file_type` varchar(255) NOT NULL DEFAULT '',
      `up_date` int(11) NOT NULL DEFAULT '0',
      `up_day` int(11) NOT NULL,
      `up_upload_by` int(11) NOT NULL,
      `up_title` varchar(255) NOT NULL,
      `up_f_id` int(11) NOT NULL,
      PRIMARY KEY (`up_id`),
      KEY `up_s_type` (`up_s_type`),
      KEY `up_s_id` (`up_s_id`)
    ) 
    
    Code (markup):
     
    mastamindz, May 22, 2012 IP
  2. DaySeven

    DaySeven Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    0
    #2
    That's a lot of SQL to dig through, do you know which section actually causes the error?

    You might try doing a section at a time until you know which CREATE or INSERT is causing the error. Then it will be much easier to determine the issue.
     
    DaySeven, May 22, 2012 IP
  3. iMarcus

    iMarcus Active Member

    Messages:
    122
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    90
    #3
    here it is...
    Wrong type of quotes on `ci_c' use `` around field names and table names and ' ' around values.

    You have used two different types on a field :cool:
     
    Last edited: May 27, 2012
    iMarcus, May 27, 2012 IP