Sunday, October 24, 2010

Create csv file in php

$data = "Id, FirstName, LastName, Email, Phone, ZipCode"."\n";
$data .= "1,'Test1','Test2','Test@gmail.com','546435','10001'"."\n";

$myFile = "userinfo.csv";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $data);
fclose($fh);

No comments:

Post a Comment