Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. <?php
  2.     header("Content-Type: text/html; charset=UTF-8", true);
  3.     require("connec.php");
  4.    
  5.     $cpf_agendamento          = trim(filter_input(INPUT_POST, 'cpf_agendamento', FILTER_SANITIZE_STRING));
  6.     $dtNascimento_agendamento = trim(filter_input(INPUT_POST, 'dtNascimento_agendamento', FILTER_SANITIZE_STRING));
  7.    
  8.     $sqlSelect  = ' SELECT automovel_etapaUm_nome,automovel_etapaUm_sexo,automovel_etapaUm_dataNascimento,automovel_etapaUm_rg FROM cadastro_automovel ';
  9.     $sqlSelect .= ' WHERE automovel_etapaUm_cpf ';
  10.     $sqlSelect .= ' IN(SELECT cpf_agendamento FROM cadastro_agendamento WHERE cpf_agendamento = :cpf_agendamento) ';
  11.    
  12.     try{
  13.         $qr = $conn->prepare($sqlSelect);
  14.         $qr->bindValue(':cpf_agendamento',$cpf_agendamento,PDO::PARAM_STR);
  15.         $qr->execute();
  16.        
  17.         if( count($qr) > 0 ){
  18.             $dados = $qr->fetch(PDO::FETCH_LAZY);
  19.            
  20.             if($cpf_agendamento){
  21.                 echo $dados->automovel_etapaUm_nome;
  22.             }
  23.             if($dtNascimento_agendamento){
  24.                 echo $dados->automovel_etapaUm_dataNascimento;
  25.             }
  26.         }
  27.     }catch(PDOException $e){
  28.         echo $e->getMessage(); exit(0);
  29.     }
  30.    
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement