- function saveExisting() {
- if (($f = fopen($this->comentarioCSVConst, 'r')) == false) return false; // error
- $index = 0;
- $indexSave = 0;
- while (!feof($f))
- {
- $d = fgetcsv($f, 4096);
- $index++;
- if ($d[0] == $this->id)
- {
- fclose($f);
- if (($f = fopen($this->comentarioCSVConst, 'r+')) == false) return false; // error
- while ($indexSave!=($index-1)) { fgetcsv($f, 4096); $indexSave++; }
- fputcsv($f, array( $this->id, $this->autor, $this->texto, $this->fecha ));
- fclose($f);
- return true;
- }
- }
- fclose($f);
- return false;
- }
-