Free Arcade Script
General => General Discussion => : Dillon December 03, 2011, 07:53:51 PM
-
anyone know how to set a normal variable equal to a session variable i cant seem to get it to work
-
You mean like..
$userid = $_SESSION['id'];
?
That should work. Just gotta make sure that the $_SESSION['id'] as been set to hold some sort of value first.
-
thats exactly what i mean but yet for some reason no matter what i do it wont work.
-
lets say i set it in index.php for FAS and then tried using it in another file it doesnt want to work but if i set it in that file then it will and i dont want to have to set it for every file or do i have to?
-
I'll give you some examples..
file - starter.php ->
session_start(); ->
$var = $_SESSION['blah'] ->
file - test.php ->
echo - $var
^^ thats not going to work.
file - starter.php ->
session_start() ->
$var = $_SESSION['blah'] ->
file - test.php ->
include('starter.php');
echo - $var
^^ that will work.
So set the var..
Then if you're using the index.php file add another case inside your switch().
Access the file where you try to echo the session var out by using index.php?action=case_name
-
You may also be running into the problem that it needs to be set as a global variable in any function, and again in any function declared inside that function, or passed to that function. If not, the script don't see it.
-
LOL kurt i figured that out yesterday. I was like ..........
-
If you figured it out already, then you're quicker than me. I still forget lol.
Hey, I keep saying that we don't claim to be professional grade around here, just trying our best. ROTFL