php - Have a yes or no field in database? -


for form such

is time known? yes or no

if yes asks time input.

is time flexible? yes or no

if yes asks num of hours input

how should form submission recorded in database?

should 1 record 4 fields (2 booleans , 2 non-booleans in case) in database? or store 2 non-booleans , store field null if field has no value form?

is worth having field in database yes/no submission form? if value of nonboolean field if existence of field no?

the said duplicate question doesn't address question of storing booleans fields existence. discusses representation of no data in mysql db table field.

in case use single coded column rather multiple booleans. i'd define codes (1=time not known, 2=time known - flexible, 3=time known - not flexible, etc.) , store short (1,2,3,..) values in database. reduce number of fields , simplify lookup in future. can use codes table store these codes reference purposes.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -