lundi 31 août 2015

recall the construct in codigniter

How to recall the construct as it contains all the required data for the page?

class Abc extends CI_Controller
{
       public function __construct()
       {
            parent::__construct();
            $this->load->model('xyz_m');
            $this->data['info'] = $this->xyz_m->get(); //get data
       }

       public function 123()
       {
          /*view page code*/
       }

       public function 456()
       {
          /*insert code here*/

          $this->123(); // redirect, need to load 123() with updated data from construct.
       }
}

So, how do you make the __construct initiate again so you get a new updated results from database?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire