rinteractive Posted January 2, 2008 Share Posted January 2, 2008 i am new to php and mysql. just i want to display the user id in all the pages when the user is login. i have created the session id for the user, i don't how to display the user id in all pages please any one help me and give the suggestion Thanks in Advance Quote Link to comment https://forums.phpfreaks.com/topic/84089-session/ Share on other sites More sharing options...
adam291086 Posted January 2, 2008 Share Posted January 2, 2008 if (isset($_SESSION['session name']) { echo $_SESSION['session name'] } i think that is right Quote Link to comment https://forums.phpfreaks.com/topic/84089-session/#findComment-428023 Share on other sites More sharing options...
mmarif4u Posted January 2, 2008 Share Posted January 2, 2008 Store the user id in the session and display it on other pages. But u have to start session on every page where u want to display that name or id. <?php session_start(); $userid=mysql_real_escape_string($_POST['userid']); $_SESSION['userid'] = $userid; ?> Now on other pages: <?php session_start(); $userid=$_SESSION['userid']; echo $userid; ?> Hope this will help. Quote Link to comment https://forums.phpfreaks.com/topic/84089-session/#findComment-428025 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.