Show bd field on web page

Asked

Viewed 60 times

-5

I’m new in web development, I took a course and I’m using as a base the site we developed there.
But some things I still don’t understand well and I’m having trouble pulling the field nome database. The connection is correct, but I don’t know how to do it.

    <?php
        if(!isset($_SESSION)){

            //redirecionamento
            header('location: index.php');
        }
        
            $email = $_SESSION['email'];
            $senha = $_SESSION['senha'];
            $consulta = $conexao->query('select id,nome,data_nascimento,email,senha from cadastro where email="'.$email.'" and senha=md5("'.$senha.'")');
            
            $lista=$consulta->fetch(PDO::FETCH_ASSOC);
            
            echo'<br>';
            echo'<main id="conteudo1">';
            echo'<p>Bem-Vinda, ','nome','!</p>';
            echo'</main>';
        ?>

1 answer

-3

I managed to solve!!! I changed only these fields... The rest I left as it was and it worked. Thank you!

$consulta = $conexao->query('select nome from cadastro where email="'.$email.'" and senha=md5("'.$senha.'")');
                
$lista=$consulta->fetch(PDO::FETCH_ASSOC);

echo'<p>Bem-Vindo, ',$lista['nome'],'!</p>';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.