I want to print data to a csv file, I am using this code, and I think everything is alright with the code, however the file isnt created.
$headers = array("name", "website");
$data = array(
array(
"name" => "john morris",
"website" => "google.com",
),
array(
"name" => "Alan Gustav",
"website" => "github.org",
),
);
$fh = fopen("file.csv", "w");
fputcsv($fh, $headers);
foreach($data as $fields){
fputcsv($fh, $fields);
}
fclose($fh);
I am using ubuntu and have permissions set to write, read and execute on this folders, also this folders and files are in a ntfs partition.
Any idea why is the file.csv not being created?
update: was the path on the fopen, a full path already works properlly. Thanks all.!