CodeIgniter Forums
how to pass id...pls edit my code....... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: how to pass id...pls edit my code....... (/thread-52909.html)



how to pass id...pls edit my code....... - El Forum - 07-02-2012

[eluser]atulswe1[/eluser]
1.controller

Code:
function abc($id)
     {
      $this->load->model('emp_model');
      $data['rows']=$this->emp_model->info1($id);
   $this->load->view('employee_personal_view',$data);
     }

2.model

Code:
function info1($id)
    {
    $this->load->database();  
    $query = $this->db->get_where('employee',array('id'=>$id));
    return $query->row_array();        
    }



how to pass id...pls edit my code....... - El Forum - 07-02-2012

[eluser]InsiteFX[/eluser]
CodeIgniter Users Guide - URI Routing



how to pass id...pls edit my code....... - El Forum - 07-02-2012

[eluser]atulswe1[/eluser]
what is this..can't understand



how to pass id...pls edit my code....... - El Forum - 07-02-2012

[eluser]InsiteFX[/eluser]
You need to be more specific about what and how you want pass the id.

The above is routing which is one way of passing vatiables.



how to pass id...pls edit my code....... - El Forum - 07-03-2012

[eluser]cartalot[/eluser]
if you are using default index.php
if your site name is 'mysite.com', your controller is 'View'
your method is 'abc', and the id number is '999'
mysite.com/index.php/view/abc/999