0

In codeigniter call another controller method from controller in code igniter

class ManualTrackingUpdate extends MY_Controller 
{
    
    ##constructor Define method
    public function __construct() 
    {
        parent::__construct();
        
        $this->load->library('form_validation');
        $this->load->model("TrackingUpdateInApp_model","MTUD");
      
    }  

public function UpdateDetails(){
        
     
   
       // call model 
      $Insert_details = $this->MTUD->InsertTrackingDetails($columns);
      
      // call here another controller method

    }
    
    }

how can do this with codeigniter

  • Possible duplicate of [Codeigniter Call Controller From Controller](https://stackoverflow.com/questions/5034479/codeigniter-call-controller-from-controller) – Pradeep May 22 '18 at 09:02
  • Maybe you should be looking into HMVC https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc –  May 22 '18 at 09:11

2 Answers2

0
class ManualTrackingUpdate extends MY_Controller 
{

    ##constructor Define method
    public function __construct() 
    {
        parent::__construct();

        $this->load->library('form_validation');
        $this->load->model("TrackingUpdateInApp_model","MTUD");  
    }  

    public function UpdateDetails()
    {
         // call model 
         $Insert_details = $this->MTUD->InsertTrackingDetails($columns);

         include('User.php'); 
         $user =  new User();
         $user->abc();
    }
}
Vijay Makwana
  • 911
  • 10
  • 24
0

I think this stuff will work for you. not sure but just try it.

constructor.

$this->load->library('../controllers/controllername');

and now call the function using

$this->controllername->functioname();
Rudra
  • 535
  • 4
  • 16