Learning & Integrating web technology and code help directory

How to use PHP & Convert/Export to CSV

No comments
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
  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <?  
  7. $filName = "shotdev/customer.csv";  
  8. $objWrite = fopen($filName"w");  
  9. fwrite($objWrite"\"C001\",\"Win Weerachai\",\"win.weerachai@shotdev.com\",\"TH\",\"1000000\",\"600000\" \n");  
  10. fwrite($objWrite"\"C002\",\"Jake Sully\",\"jake.sully@shotdev.com\",\"EN\",\"2000000\",\"800000\" \n");  
  11. fwrite($objWrite"\"C003\",\"Tony Stark\",\"tony.stark@shotdev.com\",\"US\",\"3000000\",\"600000\" \n");  
  12. fwrite($objWrite"\"C004\",\"Peter Parker\",\"peter.parker@shotdev.com\",\"US\",\"4000000\",\"100000\" \n");  
  13. fclose($objWrite);  
  14. echo "Generate CSV Done.<br><a href=$filName>Download</a>";  
  15. ?>  
  16. </body>  
  17. </html>  
Create a php file and save to path root-path/myphp/
Screenshot
PHP & Convert/Export to CSV
.

No comments :

Post a Comment