note 30535 deleted from function.fgetcsv by felipe

From: Date: Sun, 10 Feb 2008 13:33:25 +0000
Subject: note 30535 deleted from function.fgetcsv by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135985@lists.php.net to get a copy of this message
Note Submitter: mendi dot susanto at dmetrading dot com ---- I've tried the code above but doesn't work, so I tried to modify it... this is the code to get the first line of csv fle, puti it into TABLE 1, while the rest line of csv file will be put at TABLE 2 <?php $openfile = "tes2.csv"; $row = 0; $handle = fopen ($openfile,"r"); while ($data = fgetcsv ($handle, 1000, ",")) { if($row == '0') { $num = count ($data); print "<p> $num fields in line $row: <br>\n"; echo "This belong to TABLE 1 <br>"; for ($c=0; $c < $num; $c++) { print $data[$c] . "<br>\n"; } $row = '32'; } else { $num = count ($data); print "<p> $num fields in line $row: <br>\n"; $row++; echo "This belong to TABLE 2 <br>"; for ($c=0; $c < $num; $c++) { print $data[$c] . "<br>\n"; } } } fclose ($handle); ?>

« previous php.notes (#135985) next »