コード例 #1
0
ファイル: formulario.php プロジェクト: SystemPark/JoaoEnews
    $banco->SetCampos("*");
    $banco->SetCondicao(" id = '" . $this->uri->segment(3) . "'");
    $banco->SetTipoRetorno(1);
    $result = $banco->get();
    $dados['form']['nome'] = $result->nome;
    $dados['form']['status'] = $result->status;
}
/* * **************************************************************************
 * ****************************************************************************
 * ************************************************************************** */
$post = $this->input->post();
if ($post) {
    /*
     * Passo todos os dados para o modelo
     */
    $model = new Categorias_model();
    $model->setNome($post['nome']);
    $model->setSatus($post['status']);
    $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');
}
コード例 #2
0
ファイル: t.php プロジェクト: SystemPark/JoaoEnews
<?php

$banco = new Query_model();
$banco->SetTabelas("anunciantes");
$banco->SetCampos("*");
$banco->SetCondicao("");
$banco->SetTipoRetorno(0);
$dados['resultados'] = $banco->get();
if ($this->uri->segment(3) != '' && $this->uri->segment(4) == 'excluir' && $this->uri->segment(5) == '1') {
    $model = new Categorias_model();
    $apagar = $model->deletar_linha($this->uri->segment(3));
    $banco->exe_tupla($apagar);
    redirect($this->uri->segment(1) . '/' . $this->uri->segment(2));
}