Write .csv file
function writeToCSV($file_path, $content) {
$handle = fopen($file_path, 'a+'); // open file for appending (create if doesn't exist)
if ($handle !== false) {
fputcsv($handle, $content);
fclose($handle); // close the file handle
} else {
echo("Error opening file $file_path for writing.");
}
}