コード例 #1
0
    $novoAluno->setTxtEndereco($_POST["txtEndereco"]);
} else {
    header("location:../index.php?str=erro");
}
if (isset($_POST["vchEstado"])) {
    $novoAluno->setVchEstado($_POST["vchEstado"]);
} else {
    header("location:../index.php?str=erro");
}
if (isset($_POST["vchCidade"])) {
    $novoAluno->setVchCidade($_POST["vchCidade"]);
} else {
    header("location:../index.php?str=erro");
}
if (isset($_POST["vchNaturalidade"])) {
    $novoAluno->setVchNaturalidade($_POST["vchNaturalidade"]);
} else {
    header("location:../index.php?str=erro");
}
$con = new PDO("mysql:host=mysql.hostinger.com.br;dbname=u157910548_aluno", "u157910548_jack", "j34602796");
$stmt = $con->prepare('insert into alunos (vchNome,intIdade,bolSexo
    ,vchCpf,vchTelefone,vchEmail,vchNaturalidade,vchNacionalidade,txtEndereco,vchEstado,vchCidade) values (?,?,?,?,?,?,?,?,?,?,?)');
$stmt->bindValue(1, $novoAluno->getVchNome());
$stmt->bindValue(2, $novoAluno->getIntIdade());
$stmt->bindValue(3, $novoAluno->getBolSexo());
$stmt->bindValue(4, $novoAluno->getVchCpf());
$stmt->bindValue(5, $novoAluno->getVchTelefone());
$stmt->bindValue(6, $novoAluno->getVchEmail());
$stmt->bindValue(7, $novoAluno->getVchNaturalidade());
$stmt->bindValue(8, $novoAluno->getVchNacionalidade());
$stmt->bindValue(9, $novoAluno->getTxtEndereco());