Mysql PHP

Import csv file data into mysql database using php

Import csv file data into mysql database using php

Hi, In this tutorial I am going to explain how to Import CSV file data into mysql database.

It’s very simple to do using php. I have added Sample code for reference.

In above example I have table called ” Contacts ”  and I have my contact number and contact name in CSV file.



fgetcsv PHP function is used to read the csv data’s.

By using above code I have stored all the records into database.

Your CSV data must be like below,

Comma(,) is the separator.

Thanks!. If you like this article don’t forget to share and comment.