I am using **CodeIgniter 3**.

**Here's my `Admin` controller where I insert a record into the table `people`:**

```
class Admin extends CI_Controller {

    public function __construct() {
        parent::__construct();

    }
    public function addpeople() {
        insert in into people values('','pramod','emp0784');
    }
}

```

**This is another controller where I perform the same operation as the `Admin` controller, but it writes the same code twice.** I want to reuse the code in the `Employee` controller:

```
class Employee extends CI_Controller {

    public function __construct() {
        parent::__construct();

    }
    public function addpeople() {
       insert in into people values('','pramod','emp0784');
    }
}

```

Another way I found is to `redirect(../admin/addpeole)` in `Employee`, but it changes the URL.

**Is there any another way to reuse same code in the `Admin` controller in the `Employee` controller without changing the URL?**