Hi, sorry for the delay. I have never done what you are describing, importing csv files to excel tables, before. So I went ahead and tried it out. May be good to know about. Also my connection was very unresponsive for some reason and I restarted the wlan card.
It is necessary I think that you need to loop through each row of the result. Whether you call fputcsv in each iteration or write with standard file handling functions ought to make no difference.
You can also concatenate it to a variable and write the variable to a file. Just make sure to output it in the intended format.
P.S. Note that you need braces when you want to parse array elements within a double quoted string. For example; “id = {$entry['id]}”.