kingpabel blog csv to php

Csv PHP (Csv to php)

Csv means comma separated value.Suppose we have a csv format file,we need to import that csv file in php format.It is needed for maximum project.In this article we learn how to import a csv format file to php array.For know about array follow this.For that at first create a html form to upload a csv file.Follow below line to create a html form.

Csv file upload html form

After use this form set form action and go to this page to catch the csv file and access this csv file data.For create an csv to php array follow my below code

Csv php array

In this code i first took the csv temporary file name in a variable.Then open this file using php fopen function.Then run a while loop with php fgetcsv function and keep them data in a php array and var_dump this array to show.In while loop if you use 0 key you will get first row first column data and if you use 1 key you will get first row second column data that the process to get data.This system mostly use to make import a csv file and upload it on database.For this system if you have a php array you can easily create row on database like mysql,sqllite etc.So this the csv php system,use it and enjoy!!!!!