anujphp Posted December 20, 2008 Share Posted December 20, 2008 Hello the below code i got in forum to check where a user is logged in or not <?php if (isset($_SESSION['session_name_here'])) { // Code to be run here } ?> can anyone tell me what is this session_name_here means... in my login page i am not giving any name to the session i am starting the session and saving name and other data in variable.. does this means the name i save in variable or it is that i can give a name to session like we give to a function THANK YOU IN ADVANCE Link to comment https://forums.phpfreaks.com/topic/137800-solved-can-we-give-session-a-name-like-function-in-php/ Share on other sites More sharing options...
lanmonkey Posted December 20, 2008 Share Posted December 20, 2008 thats the name of a variable to be stored in the session. $username = "bill gates" $_SESSION['username'] = $username; read this: http://www.w3schools.com/PHP/php_sessions.asp Link to comment https://forums.phpfreaks.com/topic/137800-solved-can-we-give-session-a-name-like-function-in-php/#findComment-720490 Share on other sites More sharing options...
anujphp Posted December 21, 2008 Author Share Posted December 21, 2008 THANK YOU LANMONKEY the link is great..thanks once again Link to comment https://forums.phpfreaks.com/topic/137800-solved-can-we-give-session-a-name-like-function-in-php/#findComment-720599 Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 While your into sessions look at this example bit off a mind blower i say. this is a session created with a array but now you got 3 session's set. <?php session_start(); $x=array("john"=>"Has a big bike","paul"=>"has got a color tv","kevin"=>"has a motor bike"); foreach($x as $key=>$val){ $_SESSION['username'][$key]=$val; echo " $key ".$_SESSION['username'][$key]."<br><br> "; } ?> Link to comment https://forums.phpfreaks.com/topic/137800-solved-can-we-give-session-a-name-like-function-in-php/#findComment-720634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.