web 2.0

How to use PHP & Convert/Export to CSV

How to use PHP & Convert/Export to CSV Learn / tutorial php programming how to usingĀ  PHP export and create CSV file.

ShotDev Focus:
- PHP Create CSV file

Example

php_csv_write.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$filName = "shotdev/customer.csv";
$objWrite = fopen($filName, "w");
fwrite($objWrite, "\"C001\",\"Win Weerachai\",\"win.weerachai@shotdev.com\",\"TH\",\"1000000\",\"600000\" \n");
fwrite($objWrite, "\"C002\",\"Jake Sully\",\"jake.sully@shotdev.com\",\"EN\",\"2000000\",\"800000\" \n");
fwrite($objWrite, "\"C003\",\"Tony Stark\",\"tony.stark@shotdev.com\",\"US\",\"3000000\",\"600000\" \n");
fwrite($objWrite, "\"C004\",\"Peter Parker\",\"peter.parker@shotdev.com\",\"US\",\"4000000\",\"100000\" \n");
fclose($objWrite);
echo "Generate CSV Done.<br><a href=$filName>Download</a>";
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_csv_write.php

Screenshot

PHP & Convert/Export to CSV
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.