Welcome Guest, Not a member yet? Register   Sign In
Problem with $this->uri->segment(...)
#1

[eluser]sunpietro[/eluser]
Hi,
I'm new to the CodeIgniter and I have problem with $this->uri->segment(...).
My controller function looks like this:
Code:
function editDrink() {
        $id = $this->uri->segment(3);
        $query = 'SELECT * FROM skladniki';

        $data['header'] = $this->header();
        $data['ingred'] = $this->ManagerModel->getFromDB($query);
        if($this->input->post('submit')) {
            $name = $this->input->post('name',TRUE);
            $desc = $this->input->post('desc',TRUE);
            $res = $this->ManagerModel->updateDrink($id,$name,$desc);
            $this->index();
        }
        else {
            $data['drink'] = $this->ManagerModel->getDrink($id);
            $data['alert'] = '';
            $data['id'] = $id;
            $this->load->view('manager_editDrink',$data);
        }
    }
I'm trying to use this to redirect into editDrink view but I get 404 error. But am I doing wrong?
#2

[eluser]tkaw220[/eluser]
404 error means the file name manager_editDrink.php does not exist or it is not placed inside your application views folder.
#3

[eluser]sunpietro[/eluser]
But it exists in the correct folder. The same as other views, that work correctly.




Theme © iAndrew 2016 - Forum software by © MyBB