SirChick Posted August 10, 2007 Share Posted August 10, 2007 If the user just logged into the main page how do you get the code to load that particular person's details :S If i used a SELECT FROM WHERE what do i put under the "WHERE" cos i cant put "where userid = 1 cos then only user id 1 will be displayed even if they are not user id ...what is the logical way to load the correct data? Quote Link to comment https://forums.phpfreaks.com/topic/64330-getting-infomation-but-how-do-i-know-which-info/ Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 use session Quote Link to comment https://forums.phpfreaks.com/topic/64330-getting-infomation-but-how-do-i-know-which-info/#findComment-320730 Share on other sites More sharing options...
SirChick Posted August 10, 2007 Author Share Posted August 10, 2007 but how would the session know which user it is if u get me Quote Link to comment https://forums.phpfreaks.com/topic/64330-getting-infomation-but-how-do-i-know-which-info/#findComment-320732 Share on other sites More sharing options...
Fadion Posted August 10, 2007 Share Posted August 10, 2007 When a user logins, u compare the submited data with the database ones. If those are equal then u grant them privileges by assigning them a session. U can use the session to save the user's id and then use that session to display that user's personal details in the another page. Ex. login $query = mysql_query("SELECT * FROM table WHERE user='$user' and pass='$pass'"); if(mysql_num_rows($query) == 1){ $values = mysql_fetch_array($query); $id = $values['id']; $_SESSION['logged'] = $id; } details $id = $_SESSION['logged']; $query = mysql_query("SELECT * FROM table WHERE userid='$id'"); $values = mysql_fetch_array($query); echo $values['name']; echo $values['surname']; echo $values['email']; Hope it was helpful. Quote Link to comment https://forums.phpfreaks.com/topic/64330-getting-infomation-but-how-do-i-know-which-info/#findComment-320738 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.