RE: [PHP] How do i retrieve the records that are NOT linked?

2001-10-20 Thread Jack Dempsey

if i understand you correctly, perhaps this:

select * from categories a,category_user_rights b where a.name!=b.username;

jack

categories contains:
ID,
parent_ID,
name

users contains:
username,
password,
name,
etc

category_user_rights contains:
username,
category_ID

How do I pull everything out of categories that a given user DOES NOT have
rights to?  ie.  every record from categories that does not have a record
in category_user_rights linking it to a username such as fred

Any help on this would be greatly appreciated!

Thanks!

Simon Kimber


--
PHP General 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]



-- 
PHP General 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]




RE: [PHP] How do i retrieve the records that are NOT linked?

2001-10-20 Thread Simon Kimber

 if i understand you correctly, perhaps this:

 select * from categories a,category_user_rights b where
a.name!=b.username;

 jack

When i do something like that I get loads of duplicate records including the
ones that should be there!  so if i do a group the result just looks like
i've selected everything...

here's my query for getting all the (sub)categories that DO have an entry in
category_user_rights...  Somehow i need to reverse it to pull out
everything but what it's returning at the moment! :o(

$sql  = SELECT categories.ID, categories.title, categories.code ;
$sql .= FROM categories, category_user_rights ;
$sql .= WHERE categories.parentcat_INC = $cat ;
$sql .= AND categories.ID = category_user_rights.category_id ;
$sql .= AND category_user_rights.username = '$username';

$result = mysql_query($sql);








Original message:


categories contains:
ID,
parent_ID,
name

users contains:
username,
password,
name,
etc

category_user_rights contains:
username,
category_ID

How do I pull everything out of categories that a given user DOES NOT have
rights to?  ie.  every record from categories that does not have a record
in category_user_rights linking it to a username such as fred

Any help on this would be greatly appreciated!

Thanks!

Simon Kimber


--
PHP General 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]



-- 
PHP General 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]