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

[eluser]Creox[/eluser]
[quote author="John_Betong_002" date="1308254970"]Have you tried using another table name?

Also try http://localhost/phpmyadmin/index.php and check your database and tables.
 
 [/quote]

John,

The tbales are in the database that i connect to succesffully.

When I exectue the following code

Code:
$query = $this->db->query('SELECT * FROM users WHERE UserID = '.$userID.' LIMIT 1');
        return $query->result();

I expect to get a result back.

However I get the following

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: User_model::$db

Filename: models/user_model.php

Line Number: 14

Fatal error: Call to a member function query() on a non-object in C:\wamp\www\GREENStore\application\models\user_model.php on line 14

i have autoloaded the database in config/autoload.php

Code:
$autoload['libraries'] = array('database');

What else could it be? This is driving me insane.

I have just downloaded CI v2.01 at the error still occurs.

Please help.

Thanks

Ciaran


Messages In This Thread
Fatal error: Call to a member function query() on a non-object - by El Forum - 06-16-2011, 09:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB