Results 1 to 2 of 2

Thread: Inserting Multiple Products into db

  1. #1
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default Inserting Multiple Products into db

    I have managed to insert one product into the dbase using the following syntax

    INSERT INTO multiprods (ProductName, ImageSrc, URL, Category, Description, Country, Company)
    VALUES ('Aloecure Free Trial', 'images/42/182/5135.jpg', 'http://affiliates.adorablyyou.com/z/5135', 'Health', 'AloeCure helps naturally balance the stomach’s pH, decreasing the acidity and preventing that burning feeling so many complain of.', 'All', 'CPA')

    and the MySql accepts it without a problem.

    When I try to import the following file I get a 1064 syntax error and I am hoping someone here can tell me where the error is because I have searched for an answer to no avail.

    INSERT INTO multiprods (ProductName, ImageSrc, URL, Category, Description, Country, Company)
    VALUES ('Aloecure Free Trial', 'images/42/182/5135.jpg', 'http://affiliates.adorablyyou.com/z/5135', 'Health', 'AloeCure helps naturally balance the stomach’s pH, decreasing the acidity and preventing that burning feeling so many complain of.', 'All', 'CPA';
    'Product B', 'images/42/182/5498.gif', 'http://www.supplierB.com', 'Kitchen',Long description', 'UK', 'AYL')

    Since there are going to be about 750 inventory items to insert into the database, I am hoping I do not have to do this one at a time so I would be grateful for some guidance.

    Thank you
    D

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Your problem is that you put a semi-colon in the middle of the line, so MySQL thinks you are done when you aren't. Try something like this:

    Code:
    INSERT INTO multiprods (
        ProductName,
        ImageSrc,
        URL,
        Category,
        Description,
        Country,
        Company
    )VALUES (
        'Aloecure Free Trial',
        'images/42/182/5135.jpg',
        'http://affiliates.adorablyyou.com/z/5135',
        'Health',
        'AloeCure helps naturally balance the stomach’s pH, decreasing the acidity and preventing that burning feeling so many complain of.',
        'All',
        'CPA'
    ),(
        'Product B',
        'images/42/182/5498.gif',
        'http://www.supplierB.com',
        'Kitchen',
        'Long description',
        'UK',
        'AYL'
    );
    See the MySQL Reference for more.

    You were also missing a single quote, but I assume that was a typo. When posting code, even MySQL code, it's helpful to put it in code tags and make is as easy to read as possible.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

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
  •