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 plz.

 

-Thanks

 

-Terry

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.