Ok my website is almost done and there is just a couple more things that need completing. My biggest problem is that I need to implement privileges for certain user groups.
for example I have two tables the first (members) stores information on the members like name, rank and privilege.
on my 2nd table (ranks) I have rank names, and the privilege number associated to it.
on my php website I can test for the privilege if I added a number to the members.privilege just so I Know its working.
I have set up relations so that the rank names will appear in the members table but I need to also set up a relation to add the privilege to the members WHERE the rank name corresponds to the right privilege. At the minute if I add a "1" privilege on the ranks table all the members have "1".
Any ideas?? Thanks
Sharing information between two tables
Page 1 of 14 Replies - 1447 Views - Last Post: 28 January 2013 - 11:45 AM
Replies To: Sharing information between two tables
#2
Re: Sharing information between two tables
Posted 28 January 2013 - 09:37 AM
Quote
I have two tables the first (members) stores information on the members like name, rank and privilege.
Why would you set up a single user to privilege system? It sounds like one user can have many privileges... so make up a table of user ids to privilege ids.
Quote
I have set up relations so that the rank names will appear in the members table but I need to also set up a relation to add the privilege to the members WHERE the rank name corresponds to the right privilege.
What?
#3
Re: Sharing information between two tables
Posted 28 January 2013 - 10:46 AM
It doesn't matter anymore I fixed my problem
#4
Re: Sharing information between two tables
Posted 28 January 2013 - 10:47 AM
Care to explain?
#5
Re: Sharing information between two tables
Posted 28 January 2013 - 11:45 AM
Well I realised that it was stupid of me to want to use the privileged value from the ranks table in the members table. So on the ranks table I associated a Rank Name to a privilege value. On the members table I have the members a Rank (FK from ranks table). Then I handled the rest within my php code here is the SQL and php code that make it work.
$sql="SELECT Member_Rank, Privilege FROM members, ranks WHERE Member_Names='$_SESSION[myusername]' AND Member_Rank=Rank_Name";In the SQL code I used some other values for something else.
$rank = mysql_query($sql);
$query_row=mysql_fetch_array($rank);
if($query_row[Privilege]==1){
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote






|