Re: permissions

From: Date: Mon, 27 Nov 2000 20:10:25 +0000
Subject: Re: permissions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27445@lists.php.net to get a copy of this message
On Mon, 27 Nov 2000, magnus wrote: > Hello, > I'm trying to figure out a way to check for a user's database > permissions (read, write). > I've got my sql result as a single array - R W - (it's one column in the > db). > I want to check each array char , but I can't seem to get at the array > contents. > I'm very stuck. Hope the following is senseful... > Thanks, > Magnus Lawrie > > if (isset($sess_usr[2])) // if true then get permissions > { > $sql="SELECT rule FROM usr_tbl_ruls WHERE > cftab_id=$fid AND usrgrp_id=$sess_usr[1]"; > echo "$sql<br>"; > $result=pg_exec($conn, $sql) > or die ("failed to execute sql rules query"); > $num = pg_numrows($result); > for ($i=0; $i<$num; $i++) > { > $r = pg_fetch_row($result, $i); > > for ($j=0; $j<count($r); $j++) > { > echo "$r[$j]&nbsp;"; > if ($r[$j] = R) > { $read = true; > echo $read; > } > else { $read = false; > echo $read; > } > if ($r[$j] = W) > { > $write = true; > echo $write; > } > else { $write = false; > echo $write; > } > > } > $r[$j] just gets inside the fields of the query. You need something like $r[$j][$k] to get at the characters in the field in your query. -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#27445) next »