I am attempting to add a function that will create a csv for download from a certain table in the db. I have got it partially working but cannot figure out how to exclude certain columns from the rows section of the csv. Here is my code so far,

I have excluded the columns invhead_id and note from the $result output but also need to exlude them from the $values output as well however this is the bit I cannot get to work. Can anyone point me in the right direction?