Welcome Guest, Not a member yet? Register   Sign In
Problems with a model
#10

[eluser]Michael Wales[/eluser]
Yeah, as I thought.

Code:
// The $this in this line is referrign to reminders_model
  // We need to make it refer to the CodeIgniter super object
  $users=$this->groups_model->get_group_users($groupid);


New code:
Code:
function add_reminders_for_event ($eventid,$eventdate,$firstreminddays,$secondreminddays,$remindforname,$remindforrelid,$notes,$groupid) {
  $CI =& get_instance();
  $users = $CI->groups_model->get_group_users($groupid);
}

You can also make this a class variable, if you will be calling model-to-model a lot. get_instance() is just one of the global functions CodeIgniter provides that returns the CI super object.


Messages In This Thread
Problems with a model - by El Forum - 01-09-2009, 07:44 AM
Problems with a model - by El Forum - 01-09-2009, 08:21 AM
Problems with a model - by El Forum - 01-09-2009, 08:33 AM
Problems with a model - by El Forum - 01-09-2009, 01:03 PM
Problems with a model - by El Forum - 01-09-2009, 01:08 PM
Problems with a model - by El Forum - 01-09-2009, 01:44 PM
Problems with a model - by El Forum - 01-09-2009, 02:03 PM
Problems with a model - by El Forum - 01-09-2009, 02:08 PM
Problems with a model - by El Forum - 01-09-2009, 02:10 PM
Problems with a model - by El Forum - 01-09-2009, 02:22 PM
Problems with a model - by El Forum - 01-09-2009, 02:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB