Welcome Guest, Not a member yet? Register   Sign In
creating columns
#8

[eluser]TheFuzzy0ne[/eluser]
Aaah, I think I understand what you mean. Again, it comes down to table structure.

Code:
users

+----+----------+---------------+----
| id | username | password_hash | ...
+----+----------+---------------+----
| .. |   ...    |     ...       | ...

privileges

+----+------+
| id | name |
+----+------+
| .. | ...  |

privileges_users

+---------+--------------+
| user_id | privilege_id |
+---------+--------------+
|   ...   |     ...      |

With the above structure, it's easy to add new privileges and to asign privileges to a user (without adding any extra columns). You could do a separate query to get the permissions, or you could get all of the permissions for a given user in a single query, in which case you'd need to have a little extra logic to counteract the cross join effect.


Messages In This Thread
creating columns - by El Forum - 04-27-2013, 02:36 AM
creating columns - by El Forum - 04-27-2013, 04:20 AM
creating columns - by El Forum - 04-27-2013, 04:58 AM
creating columns - by El Forum - 04-27-2013, 05:34 AM
creating columns - by El Forum - 04-28-2013, 10:13 PM
creating columns - by El Forum - 04-29-2013, 03:14 AM
creating columns - by El Forum - 04-29-2013, 04:20 AM
creating columns - by El Forum - 04-29-2013, 04:58 AM
creating columns - by El Forum - 04-29-2013, 05:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB