Import CSV File Data in Mysql Using PHP Code

| Last Updated: | In: PHP Tutorial


This is the easy method to upload/import your csv file data in mysql table, using the simple php code. We are using the ( PHP-PDO ) for the communicates with mysql database.

Below is the easy and simple steps for using this code. Create a mysql table using the below code :

Create database table

Select your database and create a table seoreports with id, account_name, ranking, alerts, opportunities, pdf_report fields. Open SQL tabs in phpMyadmin and Copy paste below query to create table.

Html Code

Create index.php page and ad below code.

PHP Code using PDO

In the below code i have used PDO (PHP Data Object) to connect with database and import csv data in database table.

download

Tags: , , , ,


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby.


You may also like:

Follow us!

Get Free Access of 400+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Free Guide: Learn how to implement security guideline in your WordPress site...

DOWNLOAD

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...

SEARCH NOW