michaelkirby Posted March 19, 2010 Share Posted March 19, 2010 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!!! Quote Link to comment https://forums.phpfreaks.com/topic/195816-creating-a-user-profile-and-showing-the-details-of-the-logged-in-user/ Share on other sites More sharing options...
oni-kun Posted March 19, 2010 Share Posted March 19, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/195816-creating-a-user-profile-and-showing-the-details-of-the-logged-in-user/#findComment-1028640 Share on other sites More sharing options...
michaelkirby Posted March 21, 2010 Author Share Posted March 21, 2010 Thanks!!! Worked a treat!! It's simple when you know how but I am just starting out as a developer so the help is much appreciated!! Quote Link to comment https://forums.phpfreaks.com/topic/195816-creating-a-user-profile-and-showing-the-details-of-the-logged-in-user/#findComment-1029749 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.