Welcome Guest, Not a member yet? Register   Sign In
$query->num_rows() - Fatal error: Call to a member function on a non-object
#1

[eluser]jbawarren[/eluser]
This is probably a simple problem, but I keep getting the error:

Fatal error: Call to a member function on a non-object

when i try to use the function:

$query->num_rows()

I have declared the database class ($autoload['libraries'] = array('database')Wink in the autoload file in the config folder.

can anyone tell me what I am doing wrong? I am just trying to follow the best practices that i noticed in the video tutorials.

Here is my code:

Code:
if($query->num_rows() > 0):
foreach($query as $row):
    echo form_hidden('id', $this->uri->segment(3));
    echo 'Login'.form_input('login', $row->login).'<br>';
    echo 'Pass'.form_input('pass', $row->pass).'<br>';
    echo 'Sitename'.form_input('sitename', $row->sitename).'<br>';
    echo 'URL'.form_input('url', $row->url).'<br>';
    echo 'Notes'.form_input('notes', $row->notes).'<br>';
    echo form_submit('submit', 'Update Password');
endforeach;
endif;

Thanks in advance.


Messages In This Thread
$query->num_rows() - Fatal error: Call to a member function on a non-object - by El Forum - 04-20-2008, 12:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB