Increase the value of a column in a .csv file using php

1

I'm looking for some explanation or help on how to solve this problem:

$s ='1245';

$f = fopen(__DIR__ .'/datos/saved.csv', 'r');
$result = false;
while ($row = fgetcsv($f, 0, ',')) {
     if ($row[0] == $s) {
        $result = $row[2];
         $a = fopen(__DIR__ .'/datos/saved.csv', 'a');
         fputcsv($a, $result+1);
         fclose($a);
         break;
        }else{
        $result = 'url no existe';

            }
}
 fclose($f);
} 

As you can see, I'm looking for ways to increase the value of column 2 of the CSV.

If you find a result equal to the variable $ s .

I still do not know why it does not work I expect some help. thanks

    
asked by BotXtrem Solutions 05.10.2017 в 04:16
source

0 answers