mysql - PHP user dasboard with user set options -
im trying start building dashboard filled user set options such user profile private/public , adding "subjects" own variables stay on database.
i have table users. works fine.
with these properties:
- user_id - user_name - user_email - user_pass how proceed if want system user can add text such favourite color database without creating new table every new user register system.
it sounds like you're asking how create table structure in user can define own schema. example, if users defining own key/value pairs of information , each user different.
there couple of approaches take...
first, give considerable thought you're doing. user experience really call this? or free-form text fields suffice? else in system needs these individually tracked key/value pairs?
you use a schema-less database, such document store in given record can have serializable structure.
in relational database, boils down storing key/value pairs. this:
users ---------- id (pk) username password email uservalues ---------- id (pk) userid (fk users) key value with this, given user can store many key/value pairs like. , can continue expand on structure add more user data structures if necessary. 1 significant drawback becomes "stringly typed" means if value should be numeric code needs robust enough validate anywhere value used, because in backing data here going strings.
Comments
Post a Comment