Originally Posted by Fou-Lu
Or just use fgetcsv of course.
Why are you reinventing the wheel? fgetcsv has existed since like 4.0.
Fou-lu & redcoder,
Sorry for posting late update ...but In reality after applying preg_split(), It worked but now I am stuck that this things are declared in array and insterting in to the DB but as a requirement. I should able to do below things.
In the feilds of the data I have a column for email and also in DB but while inserting, it should check if the same email Id exist in the db already ?, if it is then it should ignore that row and go to another row ....
on the second things i have a column with the dd-mm-yyyy h:i:s format but while inserting it to db it should get converted in to yyyy-mm-dd H:i:s (this should require because in CSV format condition will never work nice and then user end up with duplicate records, to just avoid that if i can set up a server scripting if user, enter this date&time in any style it will get uploaded as yyyy-mm-dd h:i:s)
I am expecting above 2 conditions because most of my data would be a email unique so if multiple user uploading different data and having same email Id it should avoid doing that or different user uploading same data it should IGNORE.