Welcome Guest, Not a member yet? Register   Sign In
csv_from_result() possible bug
#1

[eluser]Unknown[/eluser]
Hi there

I am new to Codeigniter, but am really enjoying it.

I want to use the csv_from_result method but encounter an error.

the following is from line 178 DB_utility.php file.

Code:
if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
    {
        show_error('You must submit a valid result object');
    }    
    
    $out = '';
        
    // First generate the headings from the table column names
    foreach ($query->list_fields() as $name)
    {
        $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
    }
        
    $out = rtrim($out);
    $out .= $newline;
The error that I was getting was 'You must submit a valid result object'.
However I did follow the same kind of code as the
user_guide suggested.


So my hopefully logical conclusion from this is that there is a small bug.
where as the line 178 instead of being
Code:
if ( ! is_object($query) OR ! method_exists($query, 'field_names'))

should accually be
Code:
if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))

Can some one confirm with me that this is a bug?

Thanks again for creating Codeigniter.

~Enej
#2

[eluser]Unknown[/eluser]
Yeah it turns out that it is a bug and it has been reported.
http://codeigniter.com/bug_tracker/bug/5787/

Peace Tongue




Theme © iAndrew 2016 - Forum software by © MyBB