Hi,
I really do not know how to read line by line csv file and store it in the database.
I want to check datatypes, and the mandatory fields.
Please somebody help me in this
How about a DW search on 'csv database'? There are tens of entries. If still stuck, post back.
Am sorry. I did not get DW search
Does that mean you didn't understand what I posted?
DW search = Daniweb search
The search box at the top right of the screen. Type 'csv database' and press 'search'.
You'll probably find what you need there. This is a pretty common question.
Oh. Thank you .
But i am able to get only how to load but not to check datatypes and mandatory fields
OK, by that perhaps isn't such a csv issue.
You can try to load a csv directly like this:
load data local infile 'mydata.csv' into table MyTable fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(field1, field2, field3)
Although you are then at the mercy of the file contents - no php validation.
You may find the built-in csv functions useful, e.g. http://www.php.net/manual/en/function.fgetcsv.php
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.