This works for me, with tabs.
$readfile = file("file.cvs");
// Create a loop that will read all elements of the array and print out
// each field of the tab-delimited text file
for ($k=0; $k<=count($readfile)-1; $k++) {
$fields = split("\t",$readfile[$k]);
print("$fields[0]<br>");
print("$fields[1]<br>");
print("$fields[2]<br>");
}
Fonsi wrote:
i think <TAB> isn't a good kind of separation. it works for me with the | as separator that way:
<?
$fp = fopen("file.csv", "r");
while (!feof($fp)) {
$data = fgetcsv($fp, 1024, "|");
list($row1, $row2, $row3) = $data;
echo "email: $row3";
}
?>