where to store information like gender and year of birth?
Posted
by fayer
on Stack Overflow
See other posts from Stack Overflow
or by fayer
Published on 2010-06-02T21:11:29Z
Indexed on
2010/06/02
22:54 UTC
Read the original article
Hit count: 187
i have users and i need them to specify a gender (male, female) and year of birth (1930, 1931...1999, 2000).
i wonder where i should store these values:
- in the database?
- in php file?
if i store them in the database i have to manually create all entries first. but a good thing is that the user table will have constraints so the gender field will always be male or female, it cannot be something else.
if i store them in the php file (eg. as html) then i can easily add/remove values. but a con is that i dont have the constraints in database, so another value could be stored as gender by mistake, even though i could add validation in php backend so even if someone hacked the html it is not stored unless it's either male or female.
what is best practice to do this?
thanks
© Stack Overflow or respective owner