Home > DeveloperSection > Forums > How to import csv file in php?
Pravesh Singh

Total Post:411

Points:2881
Posted on    March-12-2012 2:11 AM

 PHP PHP 
Ratings:


 2 Reply(s)
 5573  View(s)
Rate this:
Hello Guys,
I want to import csv file in php but I don't have and idea because I'm naive user for php. So please help me and paste your code snippets too.

 


Arun Singh

Total Post:68

Points:476
Posted on    March-12-2012 8:36 AM

Hi Pravesh,
To import csv file data, you can use array to store data of file line by line. Check this code snippets...
<?php
 $arrResult = array();
$arrLines = file('MyCSVFile.csv');
foreach($arrLines as $line) {
$arrResult[] = explode( ',', $line);
}
?>

It might be helpful for you.

Vaidotas Dazzas
Vaidotas Dazzas

Total Post:1

Points:7
Posted on    June-14-2012 5:41 AM


Don't want to miss updates? Please click the below button!

Follow MindStick