Jump to content

Display username


th92

Recommended Posts

Hello, im kinda a n00b at this, basicly i have a table, and i want it so that when the user logs in, it will display their username. So basicly how do i take info from the table, depending on the user.

 

Could you help me please.

 

-Thanks

 

-Terry

Well you must make sure the user's info is inserted into that table first. When they login you could probably just set a cookie and then retrieve the information from the mysql database using a SELECT from statement.

 

What I would do is create a cookie for username and password. Then check if those two are set (look up "isset" on php.net). Then if the password and username match the ones in the table, retrieve the username and use an echo or print to display it.

 

you'll need to use the following code

 

isset -  to check if the cookie has been set

- http://us2.php.net/manual/en/function.isset.php

 

SELECT * FROM yourtablename WHERE username = 'setusername' AND password = 'setpassword' (this is a mysql query, look it up on google or mysql.com)

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/42003-display-username/#findComment-204092
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.