Log in

View Full Version : Inserting Multiple Products into db



Diversions
06-24-2008, 12:59 PM
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

Jas
06-25-2008, 02:21 AM
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:


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 (http://dev.mysql.com/doc/refman/5.0/en/insert.html) 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.