I have mysql db with different tables. The data between the tables are linked and I retrieve and display them by using the userid. I used the reference from PHP MYS
"Warning: fputcsv() expects parameter 2 to be array, string given inon line 17" is a very helpful message.
What that means is that in fputcsv($fp, $val);, $val is expected to be an array and it is not.
$val is an element of the $row array, so there's a problem with your query or the data in the database.