"Michiel Lange" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to