Row and data in csv
Posted: Sat Sep 03, 2005 5:28 am
Newbie here, any help most welcome!
I would like to echo a chosen field in a row in a csv file
this csv file has for example 23 columns and 35 rows
this echos $data[1] , of every row as many times as there are columns
I would like to echo only $data[1] of for example $row[3]
If this is possible, any help most welcome.
Thank you for your kind interest.
I would like to echo a chosen field in a row in a csv file
this csv file has for example 23 columns and 35 rows
Code: Select all
<?php
$row = 0;
$handle = fopen("example.txt", "r");
while (($data = fgetcsv($handle, 10000, ",")) !== FALSE) {
$num = count($data);
$row++;
for ($c=0; $c < $num; $c++){
echo $data[1] ."<br>------<br>\n";
}
}
fclose($handle);
?>I would like to echo only $data[1] of for example $row[3]
If this is possible, any help most welcome.
Thank you for your kind interest.