CodeIgniter Forums
A view or another HELP PLEASE - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: A view or another HELP PLEASE (/showthread.php?tid=46501)



A view or another HELP PLEASE - El Forum - 11-03-2011

[eluser]Unknown[/eluser]
Hi all i am a newbie in codeigniter and i started a little project as basic training, but i have a problem i have a controller and a method in that controller how can swich between two views. To be more explicit i will paste the code because all i'm getting are two vies loaded:


function update(){
//i want to execute this
$this->load->model('users_model');
$data_1['users'] = $this->users_model->getUsers();
$this->load->model('cars_model');
$data_2['cars'] = $this->cars_model->getCars();
$data = array_merge($data_1,$data_2);
$this->load->view('updateCars', $data );
$id = $this->input->post('id');

$Make = $this->input->post('Make');
$Year = $this->input->post('Year');
$Price= $this->input->post('Price');
$Description = $this->input->post('Description');
$this->db->query("UPDATE cars SET Make='$Make',Year='$Year',Price='$Price',Description='$Description' where id='$id';") ;
//and then this but the 'updateCars' view remains when i load the new page so i want to do all these instructions and after they execute to load this last view alone whitout the previous one

$this->load->view('loggedin');

}


Any help is apreciatedBig Grin