Welcome Guest, Not a member yet? Register   Sign In
Multiple calls to model in controller fails
#2

[eluser]InsiteFX[/eluser]
Code:
function start() {

        $this->load->model('Client_model', '', TRUE);

        // you are get your records here!
        $rs =  $this->Client_model->GetActiveClients();

        foreach ($rs as $client_rec) {

            $client_id = $client_rec['ClientID'];
            $plan_start_date = $client_rec['ClientPlanStartDate'];
            $trial_end_date = $client_rec['ClientTrialEndDate'];

            //convert date strings to time for comparison
            $trial_end_date = strtotime($trial_end_date);
            $current_date = strtotime(date("Y-m-d"));

            $trial_start_next_day = strtotime($client_rec['ClientTrialStartDate']." +1 day");
           if ($current_date == $trial_end_date) {
                 $this->_email_user_trial_expired($client_id);

                 // you need to update your $rs records!
                 // after you run this do a redirect back to start
                 // to reload your $rs records.
                 $this->Client_model->RemoveTrial($client_id);
              
             } elseif ($current_date == $trial_start_next_day) {                
                $this->_email_user_welcome_nextday($client_id);

            }
        }
    }

InsiteFX


Messages In This Thread
Multiple calls to model in controller fails - by El Forum - 12-04-2010, 02:18 PM
Multiple calls to model in controller fails - by El Forum - 12-04-2010, 04:04 PM
Multiple calls to model in controller fails - by El Forum - 12-04-2010, 06:49 PM
Multiple calls to model in controller fails - by El Forum - 12-06-2010, 05:19 AM
Multiple calls to model in controller fails - by El Forum - 12-06-2010, 08:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB