Thread: Importing data

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Aug 2011
    Posts
    10
    Plugin Contributions
    0

    Default Importing data

    I have a similar need but would like to know how to do it myself as it seems like a relatively easy process. I have read the FAQs and other information from this site and other but I still cannot seem to figure out what I am doing wrong.

    I am running the latest version of Zen Cart, fresh install and so far no addons have been added (I actually scrapped my last cart because I was being reckless with addons and not backing my stuff up...) All I have done was added a template that does not affect database files.

    I had gotten some considerable amount of work done with the site before it went up in flames (I do not feel like getting into it..). I figured that to save some time, I could backup my database and drop select pieces of it. I did not know which options to select to get an easy-to-drop .sql file so I just went with something (I do not remember what). I then opened up the file and started eliminating all of the information that I did not want to include (most of which were entries that I knew was going to be loaded with a fresh install and blank data tables) I cleaned it up a bit so now my .sql file has a series of data insert commands...

    I am using 'REPLACE' commands just in case there are database entries that would add a primary key that was already used (so it overrides it instead). I have gone through and made sure the alterations as made by the addons were deleted. The link below is to my database with ONLY NON-SENSITIVE information being shown:

    2monkey.com/fairydus_zc1.sql

    The error I am receiving the following message when I try to upload the .sql files:

    #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 '"INSERT INTO `zen_banners` (`banners_id`, `banners_title`, `banners_url`, `banne' at line 1

    I removed the " ` " (backwards apostrophe?) to see if that would work but to no avail.

    What is the proper syntax to use?

  2. #2
    Join Date
    Aug 2011
    Posts
    10
    Plugin Contributions
    0

    Default Re: JOB: Database drop to a new cart.

    idk if this will help you help me, but here is some additional info:

    PHP Version: 5.2.17

    Database: MySQL 5.0.91

    Server Host: Site5

    Been working on this for WAAY too long :\

  3. #3
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Importing data into Zen Cart

    [moderator comment]

    Your posts have been moved to their own thread. Hijacking somebody else's thread before their issue has been resolved is not appreciated in this forum, especially when your topic has such a tenuous link to the original.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  4. #4
    Join Date
    Aug 2011
    Posts
    10
    Plugin Contributions
    0

    Default Re: Importing data into Zen Cart

    Quote Originally Posted by kuroi View Post
    [moderator comment]

    Your posts have been moved to their own thread. Hijacking somebody else's thread before their issue has been resolved is not appreciated in this forum, especially when your topic has such a tenuous link to the original.
    My bad, I figured that since he was looking for contracted work that he should do so in the 'Commercial Help Wanted' section. As such, I thought my question was more relevant to his question than his own question since he is not seeming like he'll wants support for it, rather to have somebody else do it. But I digress...

    I'm new to forum posting, where do I go to get to where my link was moved to?

  5. #5
    Join Date
    Aug 2011
    Posts
    10
    Plugin Contributions
    0

    Default Re: Importing data into Zen Cart

    Quote Originally Posted by ConwayMJ View Post
    My bad, I figured that since he was looking for contracted work that he should do so in the 'Commercial Help Wanted' section. As such, I thought my question was more relevant to his question than his own question since he is not seeming like he'll wants support for it, rather to have somebody else do it. But I digress...

    I'm new to forum posting, where do I go to get to where my link was moved to?
    Never mind, I figured it out...

  6. #6
    Join Date
    Aug 2011
    Posts
    10
    Plugin Contributions
    0

    Default Re: Importing data into Zen Cart

    Quote Originally Posted by ConwayMJ View Post
    Never mind, I figured it out...
    To clarify, I figured it out where it got moved to, but I am still having problems with this. Any help would be great. I tried looking up syntax rules in Google and nothing seems to work. If somebody could just show me how the table data replacement function would work using one of the replacement commands in the .sql, that would be uber awesome and I could just replicate the process for the 30 others I need to do... this is so frustrating!

  7. #7
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Importing data

    The error that you're getting appears to relate to the quote character at the beginning of your query.

    Is it possible that you have copied Zen Cart code that wraps the query with a single or double quote, which is being translated into an HTML entity that isn't valid in SQL?

    The back quotes on the individual fields are rarely needed nowadays, at least if you're using a moderately recent version of MySQL.
    Last edited by kuroi; 1 Aug 2011 at 07:38 PM. Reason: update on back quotes
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  8. #8
    Join Date
    Aug 2011
    Posts
    10
    Plugin Contributions
    0

    Default Re: Importing data

    REPLACE `zen_banners` (`banners_id`, `banners_title`, `banners_url`, `banners_image`, `banners_group`, `banners_html_text`, `expires_impressions`, `expires_date`, `date_scheduled`, `date_added`, `date_status_change`, `status`, `banners_open_new_windows`, `banners_on_ssl`, `banners_sort_order`) VALUES
    (1, 'Wear', 'index.php', 'banner1.jpg', 'banner-1', '', 0, NULL, NULL, '0001-01-01 00:00:00', NULL, 1, 0, 1, 0),
    (2, 'Unwind', 'index.php?main_page=product_info&cPath=7&products_id=13', 'banner2.jpg', 'banner-2', '', 0, NULL, NULL, '0001-01-01 00:00:00', NULL, 1, 0, 1, 0),
    (3, 'Survive ', 'index.php?main_page=product_info&cPath=7&products_id=11', 'banner3.jpg', 'banner-3', '', 0, NULL, NULL, '0001-01-01 00:00:00', NULL, 1, 0, 1, 0),
    (4, 'COBRABRAID', 'index.php?main_page=product_info&cPath=7&products_id=11', 'banner4.jpg', 'banner-4', '', 0, NULL, NULL, '0001-01-01 00:00:00', NULL, 1, 0, 1, 0),
    (5, 'Nike Running', 'index.php?main_page=product_info&cPath=7&products_id=11', 'banner5.jpg', 'SideBox-Banners', '', 0, NULL, NULL, '0001-01-01 00:00:00', NULL, 1, 0, 1, 0);
    I tried removing those backward apostraphe's and importing it but it did not work. I am not seeing any unneccessary single or double quotes, just the unneccesary `s that I tried removing but I still got the same error.

    When I open up the .sql, it opens up in Excel and it goes:

    REPLACE affected_table (column headers) VALUES

    then on separate lines it goes:

    (value1,value2,etc),
    (value1-2,value2-2,etc),
    (etc);

    could it be because it is not all on the same line?
    Last edited by ConwayMJ; 1 Aug 2011 at 07:49 PM. Reason: needed to change somethign?

  9. #9
    Join Date
    Aug 2011
    Posts
    10
    Plugin Contributions
    0

    Default Re: Importing data

    Quote Originally Posted by kuroi View Post
    The error that you're getting appears to relate to the quote character at the beginning of your query.

    Is it possible that you have copied Zen Cart code that wraps the query with a single or double quote, which is being translated into an HTML entity that isn't valid in SQL?
    There is no quotes in the beginning of the query when I open it up in Excel... I also am not seeing a quote character at the beginning of the query?


  10. #10
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Importing data

    The SQL that you've posted is OK and would work provided your banners table has a zen_ prefix.

    You've said that you keep getting the same error, but you haven't said what the error is when you use the REPLACE version of your query, so it's difficult to provide any help on it.

    And I don't understand why you keep opening the query in Excel. Excel has its own way of interpreting data that render is an unreliable way of viewing raw data or code.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Importing Shopify data?
    By frank18 in forum General Questions
    Replies: 3
    Last Post: 28 May 2014, 10:46 AM
  2. Importing Data
    By ysmith877 in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 19 Nov 2013, 11:20 PM
  3. Help importing data
    By Stevis2002 in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 17 Feb 2011, 06:20 PM
  4. Trouble importing data
    By isaacr25 in forum Installing on a Linux/Unix Server
    Replies: 27
    Last Post: 17 Oct 2007, 04:23 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR