I simply need to write a line to a csv:
//write entery to csv
$file = fopen("valentines.csv","a+");
//values
$values = array(
$queryParams['firstName'],
$queryParams['lastName'],
$queryParams['email'],
$queryParams['valentine'],
$queryParams['message']
);
$writeCsv = fputcsv($file,$values);
fclose($file);
return array('success'=>true,'fopen'=>$file,'fputcsv'=>$writeCsv,'exists'=>file_exists("valentines.csv"),'readable'=>is_readable("valentines.csv"),'writeable'=>is_writeable("valentines.csv"));
The return is simply for debugging right now. Here is what's returned:
exists:true
fopen:null
fputcsv:91
readable:true
success:true
writeable:true
When I check the file there's only one line in there, the one I added manually to the headers when importing.