Welcome Guest, Not a member yet? Register   Sign In
CSV import in database
#1

[eluser]René Tuin[/eluser]
Ey All,

I have a problem, I must import a csv into a database only I don't know how.
I have the following csv it contains students of a school. I use the CSVReader to put the records in a array, I have change
Code:
var $separator = ','; to var $separator = ';';
Only if I look in the array it isn't right.
I get the following output(it's a part of the output).

Code:
Array
(
    [0] => Array
        (
            [OV-nummer] => AV-MW KC GOC BOL VT 3jr
            [Roepnaam OV-er] => 0
            [Voorvoegsel] => 00-01-00
            [Familienaam] => 00-01-00
            [Adres] => BUGAUD1A
            [Postcode] =>
            [Woonplaats] => -  
415114
            [Telefoonnummer] => Desmond
            [Geboortedatum OV-er] =>
            [Status] => Ording
            [Einddatum OOK] => Marconiweg 17
            [Omschrijving opleiding] => 1401 VG
            [POK Status] => BUSSUM
            [POK Begindatum] => 035-6919438
            [POK einddatum] => 1989-10-21
            [lesgroep] => D
            [leeg] => 31-07-12
            [VDE
393981] => 0908 B90061RO00 AV-Allr. AV-MW KC GOC BOL VT 3jr
            [Pol] => 0
            [] =>
            [Albers] => 00-01-00
            [Burg vd Voort v Zijpln 75] => BUGAUD1A
            [3571 VV] =>
            [UTRECHT] =>
            [030 2944641] => Lennart
            [1991-11-13] =>
            [D] =>
            [31-07-12] =>
            [0908 B90061RO00 AV-Allr. AV-MW KC GOC BOL VT 3jr] =>
            [0] =>
            [00-01-00] =>
            [BUGAUD1A] =>
            [-  
414363] => 0908 B90061RO00 AV-Allr. AV-MW KC GOC BOL VT 3jr
            [Eric] => 0
            [van] =>
            [Amerongen] => 00-01-00
            [Tonselsedreef 35] => BUGAUD1A
            [3845 CR] =>
            [HARDERWIJK] => 592,00
375099

Do someone know what happens with the data.

Greetz
#2

[eluser]flaky[/eluser]
put some cvs sample here
#3

[eluser]René Tuin[/eluser]
I already post it.
But here is it again.

leerlingen.csv
#4

[eluser]umefarooq[/eluser]
hi i have tried this library earlier and working fine for me only you have to do a little effort is that you have to change your csv file first row according to you database table field name and pass this data array to your active record insert it will work fine
#5

[eluser]René Tuin[/eluser]
I get that, only I already get trouble with the array.
The array that I get is not good, he puts the data not right.
If you look at my csv and my array above you see its wrong.
Only I don't know what is happening with the csv.

Greetz
#6

[eluser]umefarooq[/eluser]
Hi i have created one example with database table just have look on it will work for you also just a simple example follow that

http://www.webmasterdubai.com/csv.rar




Theme © iAndrew 2016 - Forum software by © MyBB