johnnyblaze9 Posted April 21, 2008 Share Posted April 21, 2008 Can someone tell me how to generate user specific querys? What I mean is: When John Doe logs in I would like the next page to display information from my database specific to only him...and so on for other clients. Link to comment https://forums.phpfreaks.com/topic/102187-user-specific-query/ Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 If you use sessions for your login system, it's really easy. Store the user_id of the user in a session variable, and do something like this: <?php $query = "SELECT * FROM users WHERE user='{$_SESSION['user_id']}'"; $result = mysql_query($query); $user_data = mysql_fetch_assoc($result); //Then do stuff with the data, like echo "Hello, " . $user_data['username'] . "!"; ?> Link to comment https://forums.phpfreaks.com/topic/102187-user-specific-query/#findComment-523031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.