Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2007
    Posts
    128
    Plugin Contributions
    0

    Default Error with handwritten SQL script

    I'm trying to replace data in the products_attributes table via a mySQL REPLACE statement. It seemed easier to do it this way than product by product. I would really appreciate any advice on what I have wrong within this statement. I've included the first line of data as well (I thought I would just execute it within ZC as I find the error reporting very good. I can't figure this one out - here's the error and the code below it.)

    1064 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 ''products_attributes_id', 'products_id', 'options_id', 'options_values_id', 'opt' at line 1
    in:
    [REPLACE INTO products_attributes ('products_attributes_id', 'products_id', 'options_id', 'options_values_id', 'options_values_price', 'price_prefix', 'products_options_sort_order', 'product_attribute_is_free', 'products_attributes_weight', 'products_attributes_weight_prefix', 'attributes_display_only', 'attributes_default', 'attributes_discounted', 'attributes_image', 'attributes_price_base_included', 'attributes_price_onetime', 'attributes_price_factor', 'attributes_price_factor_offset', 'attributes_price_factor_onetime', 'attributes_price_factor_onetime_offset', 'attributes_qty_prices', 'attributes_qty_prices_onetime', 'attributes_price_words', 'attributes_price_words_free', 'attributes_price_letters', 'attributes_price_letters_free', 'attributes_required') VALUES ('1', '4', '1', '1', '2.44', '', '1', '1', '0.01', '', '0', '0', '1', '', '1', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0');]

  2. #2
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Error with handwritten SQL script

    You can't use apostrophes to enclose field names. Either leave them out or use backquotes instead.

    MAKE SURE YOU HAVE A GOOD RELIABLE BACKUP BEFORE YOU GO MESSING ABOUT WITH RAW DATABASE EDITS LIKE THAT!!!
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Sep 2007
    Posts
    128
    Plugin Contributions
    0

    Default Re: Error with handwritten SQL script

    Thanks - and definitely but I have tried it both ways and get errors with each.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Error with handwritten SQL script

    So, what error do you get if you remove all the apostrophes around the field names?
    (You still need them on the values, but not the fields.)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Sep 2007
    Posts
    128
    Plugin Contributions
    0

    Default Re: Error with handwritten SQL script

    Quote Originally Posted by DrByte View Post
    You can't use apostrophes to enclose field names. Either leave them out or use backquotes instead.

    MAKE SURE YOU HAVE A GOOD RELIABLE BACKUP BEFORE YOU GO MESSING ABOUT WITH RAW DATABASE EDITS LIKE THAT!!!
    Thank you - this did work. I was getting an error with line one because of an error in my data to be updated.

    Note - I was a little reluctant to post my question because I didn't want to give everyone license to go fooling around with mySQL. I know enough most times (sometimes enough to be dangerous) but I do know how to make a good back up and I know how to restore them as well! Thanks again!

  6. #6
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Error with handwritten SQL script

    Quote Originally Posted by janellez View Post
    Note - I was a little reluctant to post my question because I didn't want to give everyone license to go fooling around with mySQL.
    Excellent consideration.


    Glad you got it working.

    Now ... be careful!
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Error with new install 1.3.9d 1064 error in SQL syntax
    By Joseph M in forum Installing on a Linux/Unix Server
    Replies: 21
    Last Post: 28 Jun 2010, 06:36 PM
  2. SQL Script help
    By barnswallace in forum Basic Configuration
    Replies: 2
    Last Post: 20 Dec 2009, 03:20 AM
  3. SQL error with products in cart with attributes
    By dinosoup in forum General Questions
    Replies: 2
    Last Post: 18 Oct 2007, 05:40 AM
  4. SQL Script
    By Berserker in forum Basic Configuration
    Replies: 5
    Last Post: 27 Jul 2006, 02:20 AM

Posting Permissions

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