facarroll Posted June 4, 2010 Share Posted June 4, 2010 I have a mysql database (innoDb) with two tables. The first table is called Admin and contains the following columns. id (autoincrementing), AdminName and AdminPwd. The second table is called Users and contains columns id(autoincrementing), UserName, UserPwd and id_Admin (foreign key) I want to be able to create several administrators who can then create their own list of users, and that list is completely unrelated to other lists of users. I would appreciate some help. I can display the users in a table, but all users are displayed at the same time. I can log on as any one of the administrators to select users, but am unable to display the group belonging only to the logged in administrator. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/203842-display-a-user-group/ Share on other sites More sharing options...
ignace Posted June 4, 2010 Share Posted June 4, 2010 groups (id, name) users (id, group_id, username, password) users_lists (admin_id, user_id) Your going about it the wrong way. You don't need the extra admins table. You would check if a user is an admin (part-of group) in your application and load a user list for these users. Quote Link to comment https://forums.phpfreaks.com/topic/203842-display-a-user-group/#findComment-1067590 Share on other sites More sharing options...
facarroll Posted June 4, 2010 Author Share Posted June 4, 2010 Thanks Ignace. I'm so new I hardly get it. I'll post some code I'm using as well as the database connect file. It's a purchased program that I want to adapt to allow several administrators to create their own user groups. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/203842-display-a-user-group/#findComment-1067597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.