Re: newbie: help with array

From: Date: Mon, 28 Apr 2003 11:06:38 +0000
Subject: Re: newbie: help with array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-145503@lists.php.net to get a copy of this message
Something like: // set permissions while($perm = mysql_fetch_assoc($res)){ $_SESSION['userPermissions'][$perm['userPermission']]=1; } //check permission if($_SESSION['userPermissions']['read']) { //is allowed to read } patlebon wrote:
I have database table that contains userId and permissionId. I want to query this table and make an array/list of permissions for a user when they login and assign these to a session variable called $_SESSION["userPermissions"]. On other pages i want to check if their $_SESSION["userPermissions"] array contains certain permissions and only allow certian bits of code to be displayed if it does. I have the query to get the permissions from the database but after this im not sure what to do. Any help on how to do this would be much appreciated.


« previous php.general (#145503) next »