Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Importing Data


Guest

Recommended Posts

So I was trying to find an easier way to import my list of manufacturers (and eventually products) by using phpMyAdmin/mySQL. But I ran across a few problems while trying to upload the data back into mySQL.

 

I first went to the table named "manufacturers" clicked the "Export" tab, selected "CSV for MS Excel", selected Excel edition: "Windows", selected Compression "Zipped" and proceeded to press "Go."

 

Afterwards I opened up the excel file I had downloaded and proceeded to edit th file. Upon saving the file I selected Save As: "CSV (comma delimited)(*.csv)."

After clicking the "Save" button, I was prompted with the following message:

 

"manufacturers.csv may contain features that are not compatible with CSV (Comma delimited). Do you want to keep the workbook in this format?"

 

So I chose the option to keep the file in the .CSV format. Afterwards I went back to phpMyAdmin/mySQL and back to the table named "manufacturers." I then clicked the "SQL" Tab and I selected the location of my manufacturers.csv file and pressed "Go" only to be given the following error message in return:

 

________________________________________________________________________________

____

 

Error

SQL query:

 

manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified10, AccuTemp , , 3 /24 /20070 :09, 3 /25 /20071 :5011, Adamatic , , 3 /24 /20070 :19, NULL 13, Adamation , , 3 /25 /20071 :50, NULL 14, Advance , , 3 /25 /20071 :50, NULL 15, Aervoid , , 3 /25 /20071 :51, NULL 16, Alto - Shaam , , 3 /25 /20071 :51, NULL

MySQL said:

 

#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 'manufacturers_id,manufacturers_name,manufacturers_image,date_add

 

________________________________________________________________________________

____

 

 

 

Can anyone tell me what I'm doing wrong/ how to import the data into phpMyAdmin/mySQL?

 

Thanks In Advance,

 

Joey

Link to comment
Share on other sites

Can you post some sample data from your CSV file?

 

The easiest way to do what you are trying to do is just export to a straight CSV file and not one for Windows or Excel or whatever. Secondly, once you save it Excel as a CSV file, double check the file itself from WordPad or some other text editor. Each field should have double or single quotes around it and be separated by a comma. From looking at the error you are showing in your post, there is definitely an error with your CSV file somewhere.

 

Each line in the CSV file should look something like this for a manufacturers table:

 

"1", "Some Manufacturer", "images/manufacturer.jpg", "2007-03-27 00:00", "2007-03-27 00:00"

 

If it doesn't have all five fields (manufacturer_id, manufacturer_name, manufacturer_image, date_added, last_modified) then you will get errors. Each field needs to have a separator and when you go to import make sure that you select CSV as the file type, and that the fields terminated by is set to comma (,) and that fields enclosed by is set to double quotes or whatever you used.

 

Hope that helps.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...