CodeIgniter Forums
[SOLVED] Calling function - 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] Calling function (/showthread.php?tid=70653)



[SOLVED] Calling function - davy_yg - 05-08-2018

controllers/posts.php


public function index()
    {
        
        $data["result"] = $this->posts_model->get_all();
        
        $this->load->view('admin/posts/posts', $data);
    }


public function delete_posts($id='')
    {

        $this->posts_model->delete($id);

        index();
    }

I have two functions and I want to call the index function after deleting the post?  Is that possible?

Type: Error
Message: Call to undefined function index()
Filename: C:\xampp\htdocs\coolcicms\application\controllers\posts.php
Line Number: 70

I get this error.

I also tried:

        $this->db->call_function('index');

Then I get "this feature is not available for the database that you are using."


RE: Calling function - ciadmin - 05-08-2018

Use
Code:
$this->index();
instead of
Code:
index();



RE: Calling function - InsiteFX - 05-09-2018

Why don't you take the time to sit down on a weekend and just read the CodeIgniter User's Guide???