Click here to Skip to main content
14,828,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Export CSV TO Mysql and Import to CSV from MYsql in PHP
Posted

   
use fgetcsv

PHP
<?php
$row = 1;
$handle = fopen("test.csv", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
   $num = count($data);
   echo "<p> $num fields in line $row: <br /></p>\n";
   $row++;
   for ($c=0; $c < $num; $c++) {
       echo $data[$c] . "<br />\n";
   }
}
fclose($handle);
?>
   
Comments
CHill60 1-Mar-14 14:07pm
   
Reason for downvote ... question is over 2 years old and the first link in Solution 2 uses fgetcsv

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900