MyBB Community Forums

Full Version: foreign keys for mybb_profilefields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was wondering how you are joining your mybb_profilefields to mybb_userfields and mybb_users. I am trying to determine if I can use your database structure for something else I am creating on my site. There must be a foreign key in your user table that links these 3 tables together.
mybb_profilefields holds the information about each profile field (title, description, type etc)

mybb_userfields stores each of the above profile fields for each user.

The way it works is:
- mybb_profilefields has a primary key of fid (field ID).
- When a profile field is created, it inserts data in to the mybb_profilefields column.
- Then, using the new fid for that field, an ALTER command is performed on the mybb_userfields table creating a new column called fid[fid number here].
- A ufid column in the userfield table links the values to the specific user they belong to.

Hopefully that explains it a bit better.