Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] "Non-object" fatal error when loading two models in a controller
#11

[eluser]adityamenon[/eluser]
I don't think that's it... if there was a naming error, then my model file should not work at all! Why does it work when I include $this->load->database(); in the controller?

Also, that does not explain my pagination woes...
#12

[eluser]adityamenon[/eluser]
And yes, I named my model "frontend_model.php"... sorry for forgetting to answer that Smile
#13

[eluser]vitoco[/eluser]
one detail, i think that the model must extend CI_Model

Code:
class Frontend_model extends CI_Model

and not CI_CONTROLLER as you did it
Code:
class Frontend_model extends CI_Controller

Saludos
#14

[eluser]adityamenon[/eluser]
vitoco, please kick me on my backside. hard enough that I land in the arctic circle.

THANKS! I can't believe I wasted so many people's time with this! It was THIS simple! I'm SO sorry everybody! How could I be blind to it! I never used so many exclamation marks in one sentence!

Thanks again, it's working now. Even without writing $this->load->database()

Actually, I still think CI needs to eat some of this blame >Sad How can it work so well with such a great blunder... it just limped with the half-assed code I gave it, instead of letting me know I amputated the wrong limb.

Pagination create_links() is also creating links, but pagination is not working... all rows are being shown on the same page. But I'll probably figure that out myself.

Thanks a lot people! This is something new to look out for every time I get an error from now...
#15

[eluser]adityamenon[/eluser]
Yup, I figured that out too! It was just me not supplying the offset and limit to the MySQL query in the model. Pagination is working perfectly now. Thanks all, I'll start a new thread for pagination if I have any problems Smile CI community = It's DA BEST!!!
#16

[eluser]vitoco[/eluser]
i didn't post it, but i've wasted several hours myself with the same error, extending a class badly.

Saludos




Theme © iAndrew 2016 - Forum software by © MyBB