Welcome Guest, Not a member yet? Register   Sign In
Model error
#1

[eluser]barak[/eluser]
Hi,
I have a problem loading a model.
This is how its start:

Code:
function show()
    {
        parent::Model();
        $query = $this->db->query(" SELECT *FROM `army`  WHERE `id` = '1' ")or die("error reading id");

The error is on the query line.
This is the error:
Code:
Fatal error: Call to a member function query() on a non-object in C:\wamp\www\arena\system\application\models\s_train.php on line 12

Last time I had this error because I forget to parent the function.
But now I do have this line.

Thank you.
#2

[eluser]umefarooq[/eluser]
hi are you calling database library if not you can load it in you controller or either in config/autoload file,

Code:
$this->load->library('database');
#3

[eluser]Dam1an[/eluser]
Actually, you don't load the database library like other libraries, see user guide for more info
#4

[eluser]TheFuzzy0ne[/eluser]
It should be $this->load->database(), but I think it goes through the library loader anyway, so that should work.
#5

[eluser]Dam1an[/eluser]
[quote author="TheFuzzy0ne" date="1243191583"]It should be $this->load->database, but I think it goes through the library loader anyway, so that should work.[/quote]

I knoq the db is autoloaded with the rest of the libraries, but I remember someone having a prpoblem trying to load it manually via the normal librray loader (also, its good for them to reads the docs Tongue)




Theme © iAndrew 2016 - Forum software by © MyBB