CodeIgniter Forums
csv_from_result: You must submit a valid result object - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: csv_from_result: You must submit a valid result object (/showthread.php?tid=15038)



csv_from_result: You must submit a valid result object - El Forum - 01-24-2009

[eluser]EEssam[/eluser]
Hi,

I'm getting the following error message:

You must submit a valid result object

Why trying to do:

Code:
$this->load->dbutil();

        $query = $this->db->query('SELECT * FROM user');

        $data = $this->dbutil->csv_from_result($query);

I tried the following and the rows are being correctly printed to screen:

Code:
foreach ($query->result() as $row)
{
    echo $row->userid;
    echo $row->username;
    echo $row->email;
}
So I don't see how I must submit a valid result object Sad

Please let me know what's wrong. Thanks.


csv_from_result: You must submit a valid result object - El Forum - 01-24-2009

[eluser]EEssam[/eluser]
OK, in DB_utility.php I changed this:

[code] if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
{
show_error('You must submit a valid result object');
}[code]

To this:

[code] if ( ! is_object($query))
{
show_error('You must submit a valid result object');
}[code]

And it's working now. Any idea what's wrong and if my solution is good? I'm sure it's not Sad


csv_from_result: You must submit a valid result object - El Forum - 01-26-2009

[eluser]xzela[/eluser]
hey dude,

if you're interested in the actual cause of this error check out this post:

fix for 1.7 bug:

http://ellislab.com/forums/viewthread/95597/


csv_from_result: You must submit a valid result object - El Forum - 01-26-2009

[eluser]EEssam[/eluser]
Thank you very much.