CodeIgniter Forums
[SOLVED] Show user with id - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: [SOLVED] Show user with id (/showthread.php?tid=68606)



[SOLVED] Show user with id - wendaf - 08-03-2017

Hello
I have another problem i want to show a user page like : monsite.com/user/1 but i can't i search for several hours on forum etc ...

My code : 


It my user controller
PHP Code:
   public function index($id FALSE){
        
 
       $data['user'] = $this->user_model->get_account($id);
        
$this->load->view('layout/header');
 
       $this->load->view('user/user' $data);
 
       $this->load->view('layout/footer');
 
   


And my model :

PHP Code:
    public function get_account($id)
    {
     
 $query $this->db->where('guid',$id)->get('accounts');
     
 return $query->row();
    } 


And i add this in my route :

PHP Code:
$route['user/(:num)'] = "user/user/$1"


and all time when i go to monsite.com/user/1 he say 404 not found 

i have create a views in user/user .

Thanks for help  Shy


RE: Show user with id - InsiteFX - 08-03-2017

Please see the CodeIgniter User Guide

SEE:

Remapping Method Calls


RE: Show user with id - wendaf - 08-03-2017

solved thanks you can closed the thread


RE: [solved] Show user with id - InsiteFX - 08-03-2017

Just edit your topic and add [SOLVED} in the title.