The first thing you need to learn is to validate inputs: That means checking what the user typed to make sure it is correct, valid, and reasonable data. For a "year of birth" value, "0001" is not valid - it is not reasonable to assume that anyone born over 2,000 years ago is still alive!
So read the user input, check it's numeric, and check it;s "reasonable": the oldest verified living human was 122 (
List of the verified oldest people - Wikipedia[
^]) so assume the current year to the current year minus 130 is a "reasonable" range for years. If it's outside, someone is making mistakes, or playing silly buggers - so reject their input and give them a chance to correct it.
Only when all the data is valid and reasonable do you transfer anything to your DB - this is important, because while it's fairly simple to detect and correct problems at the point of input, it gets progressively harder once the data is in the DB The longer the bad data is in teh DB the harder it gets to be able to correct it!