I am trying to set up a small Admin Panel for my local community website. We have a group of members who have volunteered to do certain updates on the site, so the office has decided to provide them with their own log-in credentials and various pages depending on their roles.
The database schema I have thought for this purpose is as below:
table1 - admin_id, admin_password, etc.
table2 - page_id, page_description
table3 - admin_id, page_id
Say I have admin_1, admin_2 and admin_3 in table1 and
say I have page_id 1 as edit, page_id 2 as approve, page_id 3 as send_email, page_id 4 as post_article in table2
Now my table3 has the following:
I have a login script that asks the admin to log in. Once login credentials are verified, it then queries table3 to list all pages that are associated with this admin id.
So for example it was admin_id 1 that logged in, the result of the above query would be page_id 1,3 and 4.
Now I am stuck at this point. I would like to retrieve pages 1,3 and 4 from table2 (which holds the page details as said above). I have a feeling that this is achieved through joins, I am not quite sure how to go about it.
Could the experts in here give me some sort of guidance/hints/tips so I can extract the data based on the above.
Your assistance is highly appreciated.