Trying to get the json converted to csv and into a file.
keep getting errors, help would be greatly appreciated…
Warning: join(): Invalid arguments passed in /root/foo.php on line 7
PHP Warning: join(): Invalid arguments passed in /root/foo.php on line 7
[php]
Have you seen the fputcsv() function?
To answer your question, $row is an associative array so you can’t just join the values that way. You would have to loop through the key => value pairs. For example:
[php]
foreach ($json as $row) {
$values = array();
foreach($row as $key => $value) {
$values[] = $value;
}
$line = “”" . join("","", $values) . “”" . PHP_EOL;
echo $line;
}
[/php]
You should also note that since you have an additional array as $value it will cause an array to string conversion warning and input “Array” to your CSV.