Learning & Integrating web technology and code help directory

How to use PHP & Read CSV file (Fgetcsv)

No comments
How to use PHP & Read CSV file (Fgetcsv) Learn / tutorial php programming how to using  PHP Read CSV (fgetcsv)
ShotDev Focus:
- PHP Read Csv
Example
php_csv_read.php
  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <?  
  7. $objCSV = fopen("shotdev/customer.csv""r");  
  8. ?>  
  9. <table width="600" border="1">  
  10. <tr>  
  11. <th width="91"> <div align="center">CustomerID </div></th>  
  12. <th width="98"> <div align="center">Name </div></th>  
  13. <th width="198"> <div align="center">Email </div></th>  
  14. <th width="97"> <div align="center">CountryCode </div></th>  
  15. <th width="59"> <div align="center">Budget </div></th>  
  16. <th width="71"> <div align="center">Used </div></th>  
  17. </tr>  
  18. <?  
  19. while (($objArr = fgetcsv($objCSV, 1000, ",")) !== FALSE) {  
  20. ?>  
  21. <tr>  
  22. <td><div align="center"><?=$objArr[0];?></div></td>  
  23. <td><?=$objArr[1];?></td>  
  24. <td><?=$objArr[2];?></td>  
  25. <td><div align="center"><?=$objArr[3];?></div></td>  
  26. <td align="right"><?=$objArr[4];?></td>  
  27. <td align="right"><?=$objArr[5];?></td>  
  28. </tr>  
  29. <?  
  30. }  
  31. fclose($objCSV);  
  32. ?>  
  33. </body>  
  34. </html>  
Create a php file and save to path root-path/myphp/
Screenshot
PHP & Read CSV file (Fgetcsv)

No comments :

Post a Comment