Archive for December, 2008

Import data from CSV file into a MySQL database

December 2, 2008

Few days ago, Client wanted to import a CSV file and all datas of this file will be inserted into a table in one project.For that, I implemented a class and contributed it in phpclasses.org site as well.For this week,this class was top first downloaded class.here the figure below.

downloadedimage

And as a author rank of this week i was 5th. here attached the screen shot.

author

Class Name : fileImporter

Description:
========

This class can be used to import data from CSV file into a MySQL database.When any CSV or text file is imported by user,Firstly the file is uploaded a temp directory then the class open , read datas from this file and insert in a given MySQL database table.After then file will be deleted this temp directory. The class supports both tab and comma separated CSV files.

Download this class from here.Details example also explained there.

Please don’t  hesitate to knock me if you guys face any problem to install this class.