Page 1 of 1

CSV import

Posted: Fri Sep 08, 2006 3:38 pm
by fabby
for the beginning, sorry for my bad english.. :)

i have a virtual magazin that is structurated lyke this:

main components(categ1) - > processor (categ2) -> AMD (categ3) - > Sempron 2600+ 64Bit TRAY(and the product with different caracteristics)

the database columns is made for category like this: id, name, id_parent

you insert the main component, with id=1 for example, the processor to have id=2, and id_parent=1(to be connected with categ1), the amd will have id=3, and id_parent=2(to be connected with the procesor), and the product, in separated table, with the id_parent=3

this site recieve product from the supplier, or, will be modified at the price, or other products, and it recieve in xls format. An exemple of products in xls:

Componente de baza Procesoare AMD Sempron 2600+ 64Bit TRAY
Componente de baza Procesoare AMD Sempron 2600+ 64Bit BOX
Componente de baza Procesoare AMD Sempron 2800+ TRAY socket A
Componente de baza Procesoare AMD Sempron 2800+ 32Bit TRAY


the problem is, that, for an simple operator, that dont know programming, how can he import csv in database structurated like this?

thanks!

Posted: Fri Sep 08, 2006 3:57 pm
by Christopher
You might want to first try the import feature of OpenOffice Calc or other spreadsheets to get the data into columns.

Posted: Fri Sep 08, 2006 4:03 pm
by fabby
can u give me a link, pls?

Posted: Fri Sep 08, 2006 4:19 pm
by alex.barylski
I'm not sure I follow you but...

If your trying to import CSV data into a database...

You could possibly use the following class: viewtopic.php?t=47855 :P

You could then probably iterate the array and generate required SQL as a series of INSERT's and away you go :)

Posted: Fri Sep 08, 2006 4:20 pm
by Christopher
fabby wrote:can u give me a link, pls?
Most spreadsheets can do this: OpenOffice Calc, Microsoft Office Excel, etc.