Well, I have a page with links to reports. Whenever somebody clicks on one report, they can download the excel file. However, sometimes there are no fields to make a report;
echo "";
and get rid of redirect line below.
redirect
You were mixing up two different worlds.