RE: [Phplib-users] user-variables and SQL select ?
Brought to you by:
nhruby,
richardarcher
|
From: Layne W. <la...@if...> - 2002-05-30 16:51:38
|
> Hello, I use user-variables to store the users setting. Now I need to
> select that users that have something enabled. If I'd used
> pure sql to
> store the settings, I could simply run a "select * .. where
> setting='y'". But how can I do it with user-variables, which are not
> readable to the sql server?
>
> PS: user value is something like this [stored in session table]:
> "RHJIb3Jha19Vc2VyOiR0aGlzLT5pbiA9ICcwJzsgJHRoaXMtPn..."
Since you are registering variables with the user class, they are recreated
on each subsequent page. So if you did this:
$setting = "something";
$user->register("setting");
then on subsequent pages you simply do this:
$db->query("SELECT * FROM some_table WHERE setting = '$setting'");
The user class handles registered variables just like the session class
does - the only difference is that the user variables are maintained across
multiple authenticated sessions.
Layne Weathers
Ifworld Inc.
|