newbie could use some quick help to get started |
[eluser]Unknown[/eluser]
Hi, just started using codeigniter so bare with me. It seems very easy to use but i need some help understanding something. if i am passing parameters like: http://domain.com/company/view/210 where 210 is my parameter, how would i code so that i could pull that record from the database? here is what i have so far: in the controller company.php Code: public function view($id) and in the model company_model.php Code: public function view($id) im sure my model is not correct, ive been trying a few things from the guide but cant seem to get it. thanks for any help!
[eluser]jairoh_[/eluser]
in Code: $data['result'] = $this->Company_model->view(); just reference the $id Code: $data['result'] = $this->Company_model->view($id);
[eluser]Unknown[/eluser]
Thanks for that info, is there a guide that talks about using parameters with sql queries? i could'nt find anything. I added the view($id); but when outputting that to a page using <?php echo $data('id'); ?> im getting: Message: Undefined variable: data
[eluser]jairoh_[/eluser]
i can't find guides but it takes a lot of experience. but if you pass it in a view ex. Code: $data [ 'id' ] = 12312; in my_view, just echo id Code: echo $id; |
Welcome Guest, Not a member yet? Register Sign In |