Welcome Guest, Not a member yet? Register   Sign In
Where to use result_array() in the controller or in the view?
#1

[eluser]Unknown[/eluser]
Hi, i have a small question.
I'm new in the MVC stuff, and i'm thinking about if i should use the result_array() method in the controller or in the model?
i know i can do both, but what is the better way?
#2

[eluser]mddd[/eluser]
I don't think there are strict rules for that. You can pass the mysql query object to your view, and use 'result_array' there. Or you can get the array in your model and pass that to the view.
If you have to do stuff to the array, like adding strings together, calculating values or whatever, then I would get the array in the model, do all the processing there and then pass it to the view.
There are no strict rules, but the key is to keep the view as simple as possible. The view is for displaying stuff, not for calculating or manipulating data.




Theme © iAndrew 2016 - Forum software by © MyBB