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!!!

 

 

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.

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.