Welcome Guest, Not a member yet? Register   Sign In
csv_from_result only returning column labels
#1
Thumbs Down 

I'm looking to use CSV from result to produce a CSV file from a query; my code is like this;
PHP Code:
                   $delimiter ",";
 
                   $newline "\r\n";
 
                   $enclosure '"';
 
                   $data $this->dbutil->csv_from_result($query$delimiter$newline$enclosure);
 
                   force_download($fileLabel.'.csv'$data); 

and only returns the following
Code:
"learnerID","NameFirst","NameLast","MobileNumber"
Which is the column labels when I know the results do have entries (as is shown in this vardump of the $query put though the result_array)
Code:
array (size=3)
 0 =>
   array (size=4)
     'learnerID' => string '17' (length=2)
     'NameFirst' => string 'Test' (length=4)
     'NameLast' => string 'Case' (length=4)
     'MobileNumber' => string '7000000000' (length=10)
 1 =>
   array (size=4)
     'learnerID' => string '18' (length=2)
     'NameFirst' => string 'Case' (length=4)
     'NameLast' => string 'Test' (length=4)
     'MobileNumber' => string '7000000000' (length=10)
 2 =>
   array (size=4)
     'learnerID' => string '19' (length=2)
     'NameFirst' => string 'a' (length=1)
     'NameLast' => string 'b' (length=1)
     'MobileNumber' => string 'c' (length=1)
What am I doing wrong?
Reply


Messages In This Thread
csv_from_result only returning column labels - by CraigAMcLeod - 05-04-2017, 11:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB