Welcome Guest, Not a member yet? Register   Sign In
Disadvantage of returning "db->result()" from the model?
#1

[eluser]taewoo[/eluser]
I've noticed a lot of the tutorials from CI guys (especially Derek) call db->result() in the view/controller (example, building RSS feed in CI.... where as I return THAT directly from the model itself. Is there a reason or advantage for doing it one way vs other?
#2

[eluser]gtech[/eluser]
in the example link you have given the only reference to $this->db->... is intended to go in a posts model, if you can dig out another example where the db call is in the view/controller someone might be able to offer a suggestion as to why.

In my opinion your understanding is correct however $this->db->... calls SHOULD be made in a model, but the call will work in a controller. If you are only writing a small application with one database table.. maybee you don't need to be too obsessed about creating a model.




Theme © iAndrew 2016 - Forum software by © MyBB