Welcome Guest, Not a member yet? Register   Sign In
Getting value of ID from view to controller to model
#1

[eluser]Unknown[/eluser]
Hello,

I have a URL in a link on my view similar to the following:

Code:
<a href="example.com/class/gather/123">

I see how to access the ID segment in the controller:

Code:
function gather($id)
{

echo $id;

}

But I'd like to something like the following in my model:

Code:
$this->load->database();
$this->db->where('person_id', $id);
$this->db->from('people');
$query = $this->db->get('');

Access the record in the database corresponding to that ID value. Pass that back to the controller, then to the view.

I get an error about undefined variable in the model. What do I have to do to pass the value of $id to the model from controller? I didn't see any examples of this.

Thanks for the help in advance!


Messages In This Thread
Getting value of ID from view to controller to model - by El Forum - 05-21-2010, 08:56 AM
Getting value of ID from view to controller to model - by El Forum - 05-21-2010, 09:29 AM
Getting value of ID from view to controller to model - by El Forum - 05-21-2010, 10:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB