Quick Question on Sessions



I would like to do the following (But it's NOT working for the
select_zip.php line below):

<?php
if(!$WALM->checkUserSession()){
?>
<li><a href="register.php">Register</a></li>
<li><a href="login.php">Login</a></li>
<?php
} else {
?>
<li>
<a href="select_zip.php?zip=<?php echo $user['zip']; ?>">Browse
Products</a></li>
<li><a href="logout.php">Logout</a></li>
<?php
}
?>

Here is checkUserSession() function:

function checkUserSession() {
if(isset($_SESSION['usalm_user']) && isset($_SESSION['usalm_pass']))
{
$sql = "SELECT * FROM customers WHERE email='" . $this->db->Scrub-
escape_string($_SESSION['usalm_user']) . "' AND password='" . $this-
db->Scrub->escape_string($_SESSION['usalm_pass']) . "'";
if($this->db->num_rows($this->db->query($sql)) > 0){
return true;
} else {
return false;
}
} else {
return false;
}
}

However I can't seem to figure out the right syntax for PHP to pull
from the person's zip code which is inside the MySQL DB and I declared
as $user['zip'] within my core includes file, so if anyone can help me
please let me know how am I going about this wrong, this seems to be
pretty basic, but I'm a bit lost here on how to pull from a logged in
session from the DB of his/her zip code. See all of the following code
to help better understand what I'm mean of the user's defined zip
that's within the DB:

echo "<p>";
if(!empty($user['organization'])) echo $user['organization'] .
"<br>";
echo $user['first_name'] . " " . $user['last_name'] . "<br>";
echo $user['address'] . "<br>";
if(!empty($user['address2'])) echo $user['address2'] . "<br>";
echo $user['city'] . ", " . $user['state'] . " " . $user['zip'];
echo "</p>";

Which you can see here I have the $user['zip'], and the link above I'm
trying to make it fill in the data per the user's zip code that's
inside his/her account, which is defined in the above.

As the string should work as such:

select_zip.php?zip=98101

As you see above, my code isn't working properly and is ONLY arraying
as such:

Any and all help is appreciated greatly, this is a simple fix, but
there is something for a beginner that I'm missing!!!
.



Relevant Pages