I have an array (mysql query result) stored in $_SESSION variable.
Now, I try to access a member of that array like:
$_SESSION["template"]["key"]
Now, the problem is that it gives only first character of the string “key”. Strangely, it runs perfectly on localhost and also did on my previous hosting. (I am now on hostgator).
What am I doing wrong?
it means that your
$_SESSION["template"]variable is a string, thus,$_SESSION["template"]["key"]evaluated to
$_SESSION["template"][0]and returns first character.Why your $_SESSION[“template”] is a string instead of being an array – is a matter of debugging. You may start it right now.
If you have
register_globalson and some variable called$tamplate, it may rewrite $_SESSION contents