Hello, I find the following code:
//Abrimos el fichero en modo c+, que permite lectura y escritura sin truncar el fichero, como hace w
$f = fopen(__DIR__ .'/datos/saved.csv', 'c+');
$cursor = 0;
while ($row = fgetcsv($f)) {
$result = $row[1];
//Actualiza la 3 columna
$res = $row[3]+1;
$row[3] = $res;
//Retrocede el cursor al principio de la fila, para sobreescribirla
fseek($f, $cursor);
//Escribe la fila con la segunda columna modificada
fputcsv($f, $row);
//Actualiza el valor de la variable cursor, para que podamos volver al principio de línea en su caso
//$cursor = ftell($f);
}
fclose($f);
This code updates the third column of saved.csv the saved.csv columns are:
570de,url,contenido,0
b9636,url,contenido,0
The process is done when updating the page The problem is that it eliminates the first column of the second row leaving the content of saved.csv like this:
570de,url,contenido,1
,url,contenido,0
I still do not understand what is wrong, I'm waiting for your help.