Msg#: 4676191 posted 9:24 pm on May 30, 2014 (gmt 0)
Hello there, 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:
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:
admin_id page_id 1 1 1 3 1 4 2 2 2 4 3 1 3 3
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.