Well, I face the following problem:
I read a csv file form disk as follows:
$fini= file($fileall); where $fileall is the filename...
Afterwards, I want to delete a 'record' and therefore I'm using the
following:
$fnew=fopen($fileall,"w");
$row=0;
foreach ($fini as $line)
{
$row++;
if ($row!=$rec)
{
fputcsv($fnew,split(',', $line));
}
}
fclose($fnew);
..where $rec is the line number that I want to delete from the
original file (it is passed through $_POST from am previous page...).
The original file is the following:
kostas,stakos,ks**@gmail.com,4546464,"Saint Christopher",1,LAG,
57200,Greece
maria,papaso,ma*******@yahoo.gr,4521028092,democra cy,73,×ÁÍÉÁ,
54254,Greece
Proto,Nik,pr***@rtuom.gr,452310456456,hall,5,thess aloniki,45454,India
and if we suppose that I want to erase line 2, it should end up to:
kostas,stakos,ks**@gmail.com,4546464,"Saint Christopher",1,LAG,
57200,Greece
Proto,Nik,pr***@rtuom.gr,452310456456,hall,5,thess aloniki,45454,India
Instead of this, I'm ending up with this:
kostas,stakos,ks**@gmail.com,4546464,"Saint Christopher",1,LAG,
57200,Greece
"
Proto,Nik,pr***@rtuom.gr,452310456456,hall,5,thess aloniki,45454,India
"
Any ideas about this?????