Re: permissions

From: Date: Mon, 27 Nov 2000 21:04:53 +0000
Subject: Re: permissions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27465@lists.php.net to get a copy of this message
On Mon, 27 Nov 2000, magnus wrote: > > $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> > > > Thanks, though take another look at the script. I added in some > comments. Maybe it's clearer (?) > The problem seems to be by the latter 'if' statement. Or I could be > totally in the wrong direction. > Magnus Lawrie > > if (isset($sess_usr[2])) // if true then get permissions > { // R, W come in no particalur order > $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;"; // prints "R"<br>"W" > ****** > // if ($r[$j]=R) {echo "true";} // always returns true if R is > present > // or not > for ($k=0; $k<count($r); $k++) > { > echo "$r[$j][$k]&nbsp;"; // prints > "R[0]"<br>"W[0]" > ****** > } > // if ($r[$j][$k] = R) {echo "true";} // empty > > echo "<BR>"; > } } } > > // echo "$r[$j][$k]<br>"; > Oh, I see. change = to === in your ifs. -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#27465) next »