[eluser]i_am_using_ci[/eluser]
Hi, I am trying to generate csv from result of my db select query...
My code (as in manual):
Code:
$this->load->dbutil();
$query = $this->db->query('select * from table where id = 1');
echo $this->dbutil->csv_from_result($query, ',', "\r\n");
I am getting error: "You must submit a valid result object"...
I am submitting valid result object as $query and my result set has about 40 rows...
I've tried to understand wtf and opened DB_utility.php CI class source, there are:
Code:
function csv_from_result($query, $delim = ",", $newline = "\n", $enclosure = '"') {
if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
{
show_error('You must submit a valid result object');
}
...
but my query result object doesn't have 'field_names' method...
What I am doing wrong?