Jump to content

best way to do this....


blueman378

Recommended Posts

hi guys,

 

im making a site which will be distributed alot,

 

anyway im looking for the best way to add custom fields to user account.

 

eg lets say the script ships default with

Username:

email:

website:

real name:

 

thats fine,

 

but if a user wanted to add in say msn:

what is the best way to make a script which they can simply enter the name, and a little bit more info (thats to be sorted later) and it stores it.

 

i mmore looking at the database side of things, would it be best to have the script make a new column in the users table under that name with say  field_msn

 

then have a script which looks at all the column names, if it finds one with field_* it outputs that information on the users page.

 

is this the best way to do it or is there a more practical way?

 

ive been told to look into blobs but i dont really understand.

 

Matt

Link to comment
https://forums.phpfreaks.com/topic/145173-best-way-to-do-this/
Share on other sites

Well you have the option of one, adding the column to the user table, then all users will have that option. But say you have (5) users that use the column out of (200) total users. It wouldn't make sense to have that column in the user table because the object of what your wanting to do is not static, it's forever changing, so the better approach is to have another table that you JOIN with the user table that holds all of the users custom fields, (custom_field_d, user_id, field_information_id [joins to the custom_fields_definition table which holds the actions_to_take, variable_name, ...], variable_value, variable_options)

Link to comment
https://forums.phpfreaks.com/topic/145173-best-way-to-do-this/#findComment-762017
Share on other sites

hmm i dont think i explained myself properly although your method would still work, i acctually meant the administator would be adding in these fields, and they will show up on all users profiles.

 

is the joining tables still the best idea?

Link to comment
https://forums.phpfreaks.com/topic/145173-best-way-to-do-this/#findComment-762385
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.