forumnz Posted September 22, 2007 Share Posted September 22, 2007 I have managed to set a session with a users id and I want to know how I can echo their ID based on the session info? Thanks, Sam. Quote Link to comment https://forums.phpfreaks.com/topic/70287-solved-get-id-from-session/ Share on other sites More sharing options...
forumnz Posted September 22, 2007 Author Share Posted September 22, 2007 More info.... it is set as userid and in the db it is id I really just want to know hoe to select other info from a database where id = userid Sam. Quote Link to comment https://forums.phpfreaks.com/topic/70287-solved-get-id-from-session/#findComment-353059 Share on other sites More sharing options...
pocobueno1388 Posted September 22, 2007 Share Posted September 22, 2007 <?php $userID = $_SESSION['ID']; $query = "SELECT * FROM table WHERE userID='$userID'"; $result = mysql_query($query); ?> To echo the ID, you would just do this. echo $_SESSION['ID']; Quote Link to comment https://forums.phpfreaks.com/topic/70287-solved-get-id-from-session/#findComment-353060 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.