vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Here is part of the structure of my current database: table permissions: id permission table groups id name table groups_permissions id_group id_permission table groups_users id_group id_user table entries: id name table entries_groups id_group id_entry One user can belong to many groups, one group can control many entries. Given a list of entries and the user_id, I need to check if that user can control those entries, and if possible return a list of entries that the user can/can't not control. Currently I'm using the query below, if the returned COUNT doesnt match the number of entries given then the user doesnt have accesst to all the give entry. Is there any better way to do this? SELECT COUNT(*)AS COUNT FROM entries_usergroups, users_usergroups, permissions_usergroups, permissions WHERE entries_usergroups.entry_id IN ($entry_list) AND users_usergroups.usergroup_id = entries_usergroups.usergroup_id AND users_usergroups.user_id = $user_id AND permissions_usergroups.usergroup_id = entries_usergroups.usergroup_id AND permissions.id = permissions_usergroups.permission_id AND permissions.name = '$permission'; Thank you. |
| Thread Tools | |
| Display Modes | |
|
|