$banco->SetCampos("*"); $banco->SetCondicao(" id = '" . $this->uri->segment(3) . "'"); $banco->SetTipoRetorno(1); $result = $banco->get(); $dados['form']['nome'] = $result->nome; $dados['form']['id_categoria'] = $result->id_categoria; } /* * ************************************************************************** * **************************************************************************** * ************************************************************************** */ $post = $this->input->post(); if ($post) { /* * Passo todos os dados para o modelo */ $model = new Categorias_sub_model(); $model->setNome($post['nome']); $model->setIdcategoria($post['id_categoria']); $inserir = $model->insert(); $alterar = $model->alterar($this->uri->segment(3)); /* * SE TIVER ID È ALTERA OS VALORES DO BANCO DE DADOS SE APENAS INSERE */ if ($this->uri->segment(3) == '') { $banco = new Query_model(); $banco->exe_tupla($inserir); } else { $banco->exe_tupla($alterar); } redirect($this->uri->segment(1) . '/t'); }