Associate logged-in user with your information?

Asked

Viewed 100 times

0

After doing "Session", how do I bring the logged in user information? i know it’s not just creating a session, I need to bring user information like Name/Nickname, avatar, email etc.

  • From what I understood in your question what you should do is take advantage of the select you do to validate the user and return your data.

1 answer

1


You can make a select in your database by retrieving user information and so you could set the object or a variable in the way you prefer containing the users in a session in this way: $_SESSION['usuario'] = $usuario and to access is almost the same:

$usuario = $_SESSION['usuario']
$usuario->getNome();
$usuario->getEmail();

In this example I make it as if I were set the object of a user within the session and I am getting its attributes through the get methods of that object. if you do not place the object of a user in the session and do not know how to access it just gives a var_dump($variavel) and have a better view about your variable

Browser other questions tagged

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