public function loadCSV()
{
$file = fopen($this->path, 'r');
$dbcnt = $this->getdbrows();
while(!feof($file))
{
if(fgetcsv($file)[$this->group] == '610')
{
$date = fgetcsv($file)[$this->datePos];
$num = $this->formatNum(fgetcsv($file)[$this->numPos]);
$rec = fgetcsv($file)[$this->recPos];
if(!(in_array($num, $this->filter)))
{
array_push($this->csvitem, $date . ';' . $num . ';' . $rec);
}
}
}
$this->writeCSV();
}
So I load a csv file using fopen
, then I go through it line by line and save date, num and rec to their variables. However, since I read the same file over and over again. I wish not to store old data over and over again. Therefor I get the number of db rows with $dbcnt
and then I wish to start at that row.
You have any ideas?