Welcome Guest, Not a member yet? Register   Sign In
csv_from_result: You must submit a valid result object
#1

[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.
#2

[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
#3

[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/
#4

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




Theme © iAndrew 2016 - Forum software by © MyBB