Jump to content

Creating a User profile and showing the details of the logged in user


michaelkirby

Recommended Posts

Hi all,

 

I'm new to PHP and have a question regarding user profiles.

 

Currently I have a table called users which stores all the information regarding the users. When the user logs into the session I would like to be able to retrieve the details of that user and have it displayed on a profile page.

 

I can display the user that is logged in but not sure how I would go about displaying all the details they entered when they registered.

 

Can any one help me please!!!

 

 

Link to comment
Share on other sites

Hi all,

 

I'm new to PHP and have a question regarding user profiles.

 

Currently I have a table called users which stores all the information regarding the users. When the user logs into the session I would like to be able to retrieve the details of that user and have it displayed on a profile page.

 

I can display the user that is logged in but not sure how I would go about displaying all the details they entered when they registered.

 

Can any one help me please!!!

 

First i'd recommend storing the user's ID in session, so information could be pulled up as needed (such as when you log in, it goes to their profile with info from $_SESSION['ID']).

 

About displaying the information on a profile, Where are you having trouble? It should be fairly straightforward to select the user's data and display the row such as:

$id = $_SESSION['ID']; //Get user's ID
$result = mysql_query("SELECT * FROM `USERS` where id='$id'");
$row = mysql_fetch_assoc($result);

print "Your user name is: " . $row['name'] . " and you registered at: " . $row['registerdated'];

 

And work from there to list results.

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.