Re: Session problem
| From: | @ Edwin | Date: | Mon, 09 Sep 2002 14:57:17 +0000 |
| Subject: | Re: Session problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115749@lists.php.net to get a copy of this message | ||
I think this one worked because
> > if($count ==1){
> > $user_data = mysql_fetch_row($user_res);
> > $user_id = $user_data[0]; // <------------------------------- of this
> > if(!session_is_registered("user_id")) session_register("user_id");
> > if(!session_is_registered("username")) session_register("username");
> > if(!session_is_registered("password")) session_register("password");
> > $ok = 2;
> > }
The way you did here is kind of different from the above.
> > else{
> > $data = mysql_fetch_row($data_res);
> > if(!session_is_registered("data")) session_register("data"); //
[trouble*]
> > }
> >
> > }//E-OF get_data($user_id)
> >
> > The $data array is definatly an array as I have done foreach echo tests
> and
> > it dumps the information i am needing. but it won't put it in the
session.
> >
*The reason _I think_ is because:
<quoted>
Note: It is not currently possible to register resource variables in a
session. For example, you can not create a connection to a database and
store the connection id as a session variable and expect the connection to
still be valid the next time the session is restored. PHP functions that
return a resource are identified by having a return type of resource in
their function definitions. A list of functions that return resources are
available in the resource types appendix.
</quoted>
from here: http://www.php.net/manual/en/function.session-register.php
- E