Welcome Guest, Not a member yet? Register   Sign In
Quick example of passing data between model and controller...
#3

[eluser]MadZad[/eluser]
A model isn't necessarily a one-trick pony - it can have many methods (functions). So, instead of the code you listed, your controller would first load the model (often in the constructor):
Code:
$this->load->model('My_model');
then call a function in the model when needed:
Code:
$myData = $this->My_model->gimme_some_data();

Therefore, your model would need that function:
Code:
class My_model extends Model {
  
  function My_model() {
    parent::Model();
  }

  function gimme_some_data () {
    // assemble data in the $results array
    return $results;
  }
}


Messages In This Thread
Quick example of passing data between model and controller... - by El Forum - 03-11-2008, 02:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB