Im having trouble with my sessions - at least thats what I think -
<?php session_start(); ?> at the top of my page...
Then Im using <?php echo $_SESSION['first_name'];?> to show the user's first name on the page and it works good.
Now Im trying to use, <?php echo $_SESSION['location'];?>
To show the users location but its not retrieving their location. And Im wondering if anyone might know why? Im retrieving the users first_name and displaying it on the page and it works ok, how come it wont retrieve their location?
If anyone knows why this is, any help would be great. What I did to try and fix this problem is approach it a different way and just used this script where I want their location:
Code: Select all
<?php
$con = mysql_connect("***","***","***") or die('Could not connect: ' . mysql_error());
mysql_select_db("login", $con);
$result = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_array($result)){
echo "{$row['location']}";
}
?>Any help would be great - thanks!