What's the best way to get a user's info from a database after they login?
For example, if I want to welcome the user after logging in:
"Welcome back, [user's first name from database]."
Now, do i need to repeat my SQL statements each and every time, using something like:
Or, does the session that I create when the user logs in remember which user (row) was selected from the database during the first log in?
SELECT username, first_name FROM users WHERE username = '$_SESSION['username']'
I'm confused, because during my tests I only have to access the columns I want without specifying the row I want on the page that the user is redirected to after logging in.