Get data from a db in a class in codeigniter

0

Good morning, I'm doing a shopping cart and it has a function to list the products, and I return an array for later I list in my view but I do not know if it would be correct for me to do this in my class or inside a model and a controller, but what I need is to get the bank data I need to know if it's possible to do it directly in the class or I have to do with model and controller. thanks in advance to all the friends

    
asked by anonymous 14.07.2015 / 15:16

1 answer

2

Well, first of all, as a good MVC practice, it's always better to treat the information that comes from the bank in the Model classes. Can you do it on the controller? Gives. Is it worth I think not. It is best to create a select method on your model that returns to your controller. That way, in other controllers that you need that same information, just search the model by the method and it is ready.

    
17.12.2015 / 11:43