Advertisement
luistavares

Busca Usuário PHP

Jun 30th, 2020
1,560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2.     $id = $_GET['id'];
  3.  
  4.     include_once "../bd.php";
  5.  
  6.     $query = "SELECT * FROM usuario WHERE id_usuario=?";
  7.     $stm = $db -> prepare($query);
  8.     $stm->bindParam(1, $id);
  9.  
  10.     if ($stm -> execute()) {      
  11.       if ($row = $stm -> fetch()) {
  12.         $id = $row['id_usuario'];
  13.         $nome_usuario = $row['nome_usuario'];
  14.         $cpf = $row['cpf'];
  15.         $senha= $row['senha'];
  16.         $data_nascimento= $row['data_nascimento'];
  17.         $sexo = $row['sexo'];
  18.  
  19.       }    
  20.     } else {
  21.       print '<p>Erro ao buscar usuario!</p>';
  22.     }
  23.      ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement