If I were you, I would put the data into one database table in the format: YYYY-MM-DD
To do this with your data, just append the day, month, and year together:
$bday = $year . "-" . $month . "-" . $day;
Then put the variable $bday into your database.
Now, in order to get a person's age from their birthday, just run a simple subtraction algorithm against the date. Off the top of my head, this should work:
$currentYear = date("Y");
$currentMonth = date("m");
$currentDay = date("d");
$year = $currentYear - substr($userQueryRow['UserBirthday'], 0, 4);
$mon = substr($userQueryRow['UserBirthday'], 5, 2);
$day = substr($userQueryRow['UserBirthday'], 8, 2);
if ($mon >= $currentMonth) {
if ($day > $currentDay)
$year--;
}
echo "You are $year years old.";
What this does is, takes the value of the current year minus the user's birth year, and puts that into $year. Then to be right down to the day, it calculates whether or not the user's birth month and birth day is greater than the current month and current day.
HTH,
insectis