I used fgetcsv()
to extract some data from a csv file. Here's the code:
<?php
$csv = fopen("csv/contracts.csv","r");
while(!feof($csv)){
$line = fgetcsv($csv,1024);
if($line[0] == '')
continue;
?>
<li><?php echo "$line[2] - $line[3]"; ?></li>
<?php
}
?>
This works perfectly in my local machine but it becomes a disaster when I upload it on my server! I passed $delimiter
with ","
to fgetcsv()
but nothing changed!
What's wrong?
PHP Version:
On local: 5.3.5
On server: 5.2.17
[EDIT]
My local output is like this:
s1 - t1
s2 - t2
s3 - t3
s4 - t4
But on server:
-
-
s3 -
s4 -