session not persisting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stuckne1
Forum Newbie
Posts: 7
Joined: Sat Nov 27, 2010 10:51 am

session not persisting

Post by stuckne1 »

Chunk of the first page. I do have session_start(); at the top of this one too.

I do this and the session ends up empty. it's just 0 every time.

Code: Select all

if(mysql_num_rows($result) > 0)
		{
			$_SESSION['login_name'] = $user_loginName;
			echo $_SESSION['login_name'];
			echo $result;	
			js_redirect('http://localhost/roomSplit/loggedIn.php',1); //Redirects to blogulate.com in 1 second.
		}
		else
		{
			echo("Wrong username/password.");
		}
2nd page

Code: Select all

<?php 
	session_start();  
	ini_set('display_errors',1); 
	error_reporting(E_ALL);
?>
<html>
	<title>Panel</title>
<body>
<?php 
	echo("Welcome " + $_SESSION['login_name']);
?>
</body>
</html>
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: session not persisting

Post by social_experiment »

What does the query for $result look like
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
stuckne1
Forum Newbie
Posts: 7
Joined: Sat Nov 27, 2010 10:51 am

Re: session not persisting

Post by stuckne1 »

fixed! Thanks.

Code: Select all

 echo("Welcome " . $_SESSION['login_name']);
Post Reply