PHP Classes

array manipulation and db insertion: parse csv files, manipulate the data, insert into mariadb

Recommend this page to a friend!
  All requests RSS feed  >  array manipulation and db insertion  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

array manipulation and db insertion

Edit

Picture of florina tudor by florina tudor - 9 years ago (2017-05-09)

parse csv files, manipulate the data, insert into mariadb

This request is clear and relevant.
This request is not clear or is not relevant.

0

I need to parse large csv files which contains Categories to be inserted into a database, while doing the following: - select distinct first column as 1st level parent Categories - select distinct second column as 2nd level child Categories, depending on what first the first column value is - repeat until the last column Not all lines have all values.

There are duplicates - Categories of different levels and with different parent categories have the same name, however, each line contains a unique combination of values.

For each category I need to fill the following fields: ID, PARENT ID*, ALL HIGHER LEVEL CATEGORIES IDs delimited by |, NAME All IDs have to be integers. Example of csv: Animalerie,Abeilles,Accessoires,, Animalerie,Abeilles,Alimentation,, Animalerie,Abeilles,Attire-essaims,, Animalerie,Rongeurs,Maison,Accessoires, Animalerie,Rongeurs,Piège,, Animalerie,Rongeurs,Poulailler,, Bagagerie/Bijoux/Mode,Bagagerie,Accessoires bagages,Cadenas,sangles Bagagerie/Bijoux/Mode,Bagagerie,Accessoires bagages,Confort de voyage, Bricolage,Boulonneuses,,, Bricolage,Coffrets outils,,,

I'm mostly interested in an idea on how best to approach the issue, rather than a class per se. Just looking at classes might do the trick. In case somebody does read these messages, thank you for your time and have a nice day, Florina

Ask clarification

Recommend package
: 
: