i've customers and that i need these to specify a gender (male, female) and year of birth (1930, 1931...1999, 2000).

i question where i ought to store these values:

  1. within the database?
  2. in php file?

basically store them within the database i must by hand create all records first. but a positive thing would be that the user table may have constraints therefore the gender area will be man or woman, it can't be another thing.

basically store them within the php file (eg. as html) i quickly can certainly add/remove values. but a disadvantage is the fact that i do not have the restrictions in database, so another value might be saved as gender in error, despite the fact that i possibly could add validation in php after sales so even when someone compromised the html it's not saved unless of course it's either man or woman.

what's best practice to get this done?


What format is the data in now? Odds are you'll have the ability to instantly place it in to the database. Ought to be good quality classes on phpclasses.org that can help. Would defiantly be worth setting up phpMyAdmin in your server (or you will have diabetes already). Makes dealing with databases a lot simpler.

Opt for a database as you'll without doubt wish to query records later and dealing with HTML (or text files) for this kind of factor will be a discomfort. As Dork stated just a little upfront work saves your sausage later!

I'd certainly opt for a database, as that's the primary reason for a database, to accommodate data. You are able to, while you stated add vices, expand collected data (i.e. addresses, telephone numbers, user likes/dislikes), and checkOrissue for data much simpler having a database. For the first entry, you will find many different ways of having data right into a database with sql. There might be a simple way to get your present customers in to the database without an excessive amount of work.

make use of a database, easy call...

Navicat may be the explosive device if this involves a gui if you're searching for that kind of deal.

Basically understand right you have to keep 1997, 1998, 1999, etc... 'Male', 'Female' values, NOT the entire user row. If is for the reason that way I believe the very best option would be store it inside a exterior file, like ini, xml, php (array), etc...

A excelent option is generate that file in the database metadata. For instance, for those who have a enum area ENUM('Male', 'Female') then you definitely create the options for the reason that way. Really you will get the default input size, number or date validators, etc...

I believe the very best option would be separate the after sales datastore in the view. What if you want to translate the page so you have to show 'Masculino' rather than 'Male' but remains within the database the worthiness 'Male'?