Find and display information from a single user through the database

0

I would like to know if anyone can help me with this code.

<?php
session_start();

Welcome

       $usuarioPF = $_SESSION['usuario_pf'];
       $senhaPF = $_SESSION['senha_pf'];
       $id = $_SESSION['idcpf'];
       $cpf = $_SESSION['cpf'];

       $sql = "SELECT nome,sobrenome FROM pessoa_fisica" or die('Nenhum resultado');;

       $result = $conecta->query($sql);

       if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {

            echo $row["nome"]."  ". $row["sobrenome"];

       }}

Registration page

<?php
session_start();

    include 'banco_dados/conexao_banco.php';

    mysqli_set_charset($conecta, 'utf8');

     if(isset($_GET['id_cpf'])){
        $id_cpf = $_GET['id_cpf'];}
     if(isset($_GET['nome'])){
        $nome = $_GET['nome'];}
     if(isset($_GET['sobrenome'])){
        $sobrenome = $_GET['sobrenome'];}
     if(isset($_GET['cpf'])){
        $cpf = $_GET['cpf'];
     if(isset($_GET['email'])){
        $email = $_GET['email'];}
     if(isset($_GET['dt_nasc'])){
        $dt_nasc = $_GET['dt_nasc'];}
     if(isset($_GET['endereco'])){
        $endereco = $_GET['endereco'];}
     if(isset($_GET['usuarioPF'])){
        $usuarioPF = $_GET['usuarioPF'];}
     if(isset($_GET['senhaPF'])){
        $senhaPF = $_GET['senhaPF'];}
        //fim do filtro

      //inserir dados na tabela pessoa_fisica  
    $stmt = $conecta->prepare("INSERT INTO 'pessoa_fisica' (id_cpf,nome,sobrenome,cpf,email,dt_nasc,endereco,usuarioPF,senhaPF) "
            . "VALUES (?,?,?,?,?,?,?,?,?)"); 
    $stmt->bind_param('ississsss', $id_cpf, $nome, $sobrenome, $cpf, $email, $dt_nasc, $endereco, $usuarioPF,$senhaPF); 
    if(!$stmt->execute()) { 
        $erro = $stmt->error;  
    } else { 
        echo "<script>alert(' Cadastro realizado com sucesso! ')</script>";
         $_SESSION['idcpf'] = "$id_cpf";
         $_SESSION['cpf'] = "$cpf";
         $_SESSION['nome_pf'] = "$nome";
         $_SESSION['sobrenome_pf'] = "$sobrenome";
         $_SESSION['email_pf'] = "$email";
         $_SESSION['usuario_pf'] = "$usuarioPF";
         $_SESSION['senha_pf'] = "$senhaPF";
    } 
       }

?>

I wanted to appear only the name of a specific user from my data database, but all the names appear, I have already tried session variables but it did not work

    
asked by anonymous 05.06.2018 / 07:02

0 answers