Re: [PHP4BETA] Session Question
[email protected] ("fredo") Thu, 15 Jun 2000 00:00:37 +0200
| Newsgroups | php.version4 |
|---|---|
| Message-ID | <[email protected]> |
check if register_globals = on in php.ini Sergio GarcĂa Murillo <[email protected]> wrote in message news:031d01bfd61d$4923ecb0$3700000a@valinor... I have a funciton in the begining of the page which checks that a variable "id" is registered in a session.. in the first pagei strat a new session and set the idto 1 and register the variable.. function set_id($user,$pwd) { global $id; $db = new FumarelDb(); $query="select cod_usuario from usuarios where username='$user' and pwd='$pwd'"; if(!$db->query($query)>0) return false; $db->next(); $id=$db->f("cod_usuario"); session_start(); session_register("id"); return $id; } and then in the other page trying this way function get_id() { global $id; session_start(); if(!session_is_registered("id")) return false; echo $id; return $id; } doesn't output nothing .. but changing the global line.. function get_id() { session_start(); if(!session_is_registered("id")) return false; global $id; echo $id; return $id; } outputs the rigth id... Why? what am i doing wrong??