Re: postgresql groups and users
| From: | Steve Brett | Date: | Wed, 05 Sep 2001 13:24:41 +0000 |
| Subject: | Re: postgresql groups and users | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12167@lists.php.net to get a copy of this message | ||
"Michiel Lange" <Michiel_Lange@actuera.com> wrote in message
news:OF55D086B0.29937DE4-ONC1256ABE.003FE018@actuera.nl...
> for my application in php I connect with a postgresql database.
> In this database I have made users and groups, where 1 user can be the
> member of many groups (n on m relation)
^^^^^^^^^^^
1 to many. 1 > n.
> That works, but how do I let php find out if a user is a member of a
> certain group?
do a select . i'm assuming that you post the user id into the groups tables.
select * from goups where group_id=7 and user_id=1;
if the query returns any results then you have a match.
so :
$numrows=pg_numrows($query);
if ($numrows>0){print"You have a match<br>";}
Steve