[thelist] Tips

Paul Backhouse paul.backhouse at 2cs.com
Wed Feb 27 10:10:03 CST 2002


<tip type="tip 1" author="Skuff">
Remember to supply tips to evolt
</tip>

<tip type="tip 2" author="Skuff">
Don't tip reminding people to tip to evolt...doh!
</tip>

Nah - seriously now:

<tip type="Databases" author="Skuff">
Normalisation is the key:
Example [Extranet: users and work groups] - you have several user's
information stored in a table in a database.
They are associated with different work groups - which means they can only
have access to certain informtion when they login to the Extranet.

A good way of doing this is:
Create 3 tables in your database (Extranet.mdb): tlbUsers, tblGroups and
tblUsersGroups

tblUser: Uid (User id: autonumber), then other info such as username,
password etc..
tblGroups: Gid (Group id: autonumber), then the GroupName
tbleUsersGroups: id (autonumber), Uid (user id), Gid (group id)

So if the user who logs on is linked with more than one group, your tables
would look something like:

tblUsers:
Uid  username  password
1    admin     normalize
2    skuff     letmein

tblGroups:
Gid  GroupName
1    Group 1
2    Group 2
3    Group 3
4    Group 4

tblUsersGroups:
id Uid Gid
1  1   1    [means user admin is in Group 1]
2  1   2    [means user admin is in Group 2]
3  2   3    [means user skuff is in Group 3]
4  2   4    [means user skuff is in Group 4]

Using your queries to collect information from the tables depending on User
id (Uid)

Meaning that if the names of the groups change you will only have to edit on
database for changes to happen throughout the site - saving you alot of
time.

</tip>

cheers

Paul (skuff)





More information about the thelist mailing list