<?
include 'db.php';
$result="SELECT * FROM users WHERE userid='$userid'";
$yo = mysql_query($result);
while($row=mysql_fetch_array($yo)) {
$month = $row['month'];
$day = $row['day'];
$year = $row['year'];
}
echo "$month $day $year";
$birth_day = $month;
$birth_month = $day;
$birth_year = $year;
echo "<br>";
echo getAge('$birth_year,$birth_month,$birth_day');
function getAge($dob)
{
$dob = date("Y-m-d",strtotime($dob));
$ageparts = explode("-",$dob);
// calculate age
$age = date("Y-m-d")-$dob;
// return their age (or their age minus one year if it's not their birthday yet, in current year
return (date("nd") < $ageparts[1].str_pad($ageparts[2],2,'0',STR_PAD_LEFT)) ? $age-=1 : $age;
}
?>
It always shows age 34!!! what's wrong with the script it suppose to be showing 15 help pplz