Welcome Guest, Not a member yet? Register   Sign In
MVC issues...trying to avoid interacting with the database from my controller
#2

[eluser]sketchynix[/eluser]
You havent designed yourself into a hole at all. You are asking the right questions to get accustomed to using MVC. Since you are interacting with the database, you will want to create a model and load the model in the controller.

Without giving too much away...

Code:
function batch_mail_sender()
    {
      $this->load->model('your_model_name');
...
Code:
 else
        {
         // Form validation success, process away
          $this->your_model_name->GetAccounts($client, $status, $imported); /*set these variables equal to the form input values (be sure to clean the data)
*/
        }

Checkout the database class a bit on how to interact with it. There are a number of ways to query

Code:
function GetAccounts($client,$status,$imported){
    $select="SELECT FROM table.accounts WHERE client = ? AND status = ? AND imported = ?";
   $run = $this->db->query($select, array($client, $status,$imported));
}


Messages In This Thread
MVC issues...trying to avoid interacting with the database from my controller - by El Forum - 09-24-2010, 01:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB