-
Variable Issue
Once a user logs in I create a global array variable to store all their info using the below.
PHP Code:
$UserDetails = mysql_fetch_row($sSQL);
$GLOBALS['UserDetails'] = $UserDetails;
echo "Hello $UserDetails[0]"; //This displays the users name
The problem is when I use the below on another php page the variable is empty. I must be doing something that is simply to correct but I can't find it :confused:
PHP Code:
global $UserDetails;
echo "Welcome $UserDetails[0]...."; //All that is displayed is Welcome ....
-
Re: Variable Issue
Global variables are not persistant accress different PHP scripts. If you want this then you will need to use sessions.
http://www.php.net/session
There is also a link in my signature to a class which allows you to save the session in a MySql database.