[eluser]al042077[/eluser]
I'm a rookie, so I apologize if this is just a stupid question. I've been searching the forum and Google for a couple hours, but can't find the answer.
In most of the CI examples, I see people setting query conditions in the controllers and then call the model function to run the actual query. For example, a controller may show:
Code:
$this->db->where('date >= ', $this->input->post('date_low'));
Then, in the model, it shows:
Code:
$rs = $this->db->get('expenses');
As I understand MVC, one advantage is to separate the data layer from the controller. So, it seems to me a more MVC-compliant way would be to pass the criteria information to model, which would then run:
Code:
$this->db->where('date >= ', $this->input->post('date_low'));
$rs = $this->db->get('expenses');
This way, all interaction with the database is contained in the model. If the purpose of the model is to separate data and control, then they should be separate. If the model is just running a simple "get" function, then the whole model seems a bit much for a single function.
Am I missing something?