Setting Sessions


(assuming session_start() is allready started)
I should be able to set sessions by doing this right

$_SESSION['blahh'] = 'foobar'; 

so in this case

$_SESSION['email'] = $row['email'];

would set the


equal to what ever


was correct? So then i could just call on


for the email.

Am i correct in this logic? I have never got sessions greatly.

You can test very quickly if it works or not by using echo to output the value in a variable.


$row['email'] = 'foobar';

$_SESSION['email'] = $row['email'];

echo $_SESSION['email'];


Ok, so my login script is not working.

		 $row = $lookup->fetchAll();
    	if($row[0] > 0){
    		if($row['salt1'].$rawPass.$row['salt2'] == $row['password'])
        		$_SESSION['email'] = $row['email'];
            	$_SESSION['id'] = $row['id'];
            	$_SESSION['name'] = $row['name'];
            	$_SESSION['level'] = $row['level'];
            	$_SESSION['farmname'] = $row['farmname'];
			$message .=  $row['name']."You have been logged in!";
			$title = "Logged in!";

This is the script that sets the sessions. I have also tryed echoing $row[‘name’] how ever nothing shows up. But when i print_r(row[0]) an array shows up correctly

FetchAll() brings back an array (PDO, right?) Judging by your code you only wanted one row, so change to fetch() otherwise, try accessing the first record in your array of results like this:

$message .=  $row[0]['name']."You have been logged in!";