I'm confused. I have problem how to add more than one line in csv archive.
In $V
I collect datas from some conditions. Then I count how many datas are collected $countLm++
.
The following code is my last try.
if ($V >= "1") {
$countLm++;
echo "Time:" . $row['DayTime'];
echo "|| AvT :". round ($row['Val(1)'],2);
echo " *C";
echo "|| ALM :". round ($row['Val(2)'],2);
echo "|| LM :" .round ($V, 2);
echo " % ";;
echo "<br />";
$sumT += (round ($row['Val1'])'],2));
$averageT = $sumT / $countLm ;
$csvFile = "saving path";
$handle = fopen($csvFile, "w");
if ($handle === false) {
exit("Error creating $csvFile");
}
fputcsv($handle, ['DayTime','AvT','ALM','LM']);
fputcsv($handle, [$row['DayTime'], round ($row['Val(1)'],2),round ($row['Val(2)'],2), round ($V, 2)]);
fclose($handle);
}
The problem is that I can "print" only one line in CSV. But I want to "print" more lines, as lines as $countLm
is.
How can I add more lines? What can I modify?
Thanks for your advices!!!!!