Beispiel #1
0
 public function updatePlusNativePlace($placeId, $plusPage)
 {
     $cn = new Conexao();
     $sql = "UPDATE places_added SET plus_page = '" . $plusPage . "' WHERE id = " . $placeId . "";
     $result = $cn->execute($sql);
     $cn->disconnect();
     if ($result != false) {
         return true;
     } else {
         return false;
     }
 }
    validaCampos($nome, $email, $professor, $nota);
    $sql = "DELETE FROM aluno WHERE nome = '{$nome}' AND email = '{$email}' AND professor = '{$professor}' AND nota = {$nota}";
    $conexao = new Conexao();
    $resultado = $conexao->execute($sql);
    if ($resultado == 1) {
        $_SESSION['sucesso'] = "Excluido com sucesso.<br>";
        header("location: 25.1 - formularioBanco.php");
    } else {
        $_SESSION['erro'] = "Erro ao excluir.<br>";
        header("location: 25.1 - formularioBanco.php");
    }
} elseif (isset($_POST['alterar'])) {
    validaCampos($nome, $email, $professor, $nota);
    $sql = "UPDATE aluno " . "SET nome = '{$nome}', email = '{$email}', professor = '{$professor}', nota = {$nota} " . "WHERE nome = '{$nome}' ";
    $conexao = new Conexao();
    $resultado = $conexao->execute($sql);
    if ($resultado == 1) {
        $_SESSION['sucesso'] = "Alterado com sucesso.<br>";
        header("location: 25.1 - formularioBanco.php");
    } else {
        $_SESSION['erro'] = "Erro ao alterar.<br>";
        header("location: 25.1 - formularioBanco.php");
    }
} elseif (isset($_POST['selecionar'])) {
    if (empty($nome)) {
        $_SESSION['erro'] = "Por favor, preencha o seu nome.<br>";
        header("location: 25.1 - formularioBanco.php");
    }
    $sql = "SELECT nome, email, professor, nota " . "FROM aluno " . "WHERE nome = '{$nome}' ";
    $conexao = new Conexao();
    $resultado = $conexao->query($sql);