CodeIgniter Forums
Help with a models and controller... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Help with a models and controller... (/showthread.php?tid=56308)



Help with a models and controller... - El Forum - 12-09-2012

[eluser]Unknown[/eluser]
Hello,

I am trying to learn how to use codeigniter and what I really need at this moment is to pass a uri segment from the controller to the model.

What I am needing is to grab a segment of the URI inside the controller, pass that segment name as a variable to the model so I can run a query based on what that variable contains.

Thanks for any help,
Anthony


Help with a models and controller... - El Forum - 12-09-2012

[eluser]apodner[/eluser]
http://example.org/segment1/segment2/segment3

Code:
$value = $this->uri->segment(2);
$this->load->model('Mymodel');
$returnValue = $this->Mymodel->someFunction($value);