I'm 32. I think at this point I've transcended novice and moved into bona fide amateur. Avg. from here = 29.7 with 9 people reporting. (297 yrs / 10 people) for those of you keeping score at home.
The answer of this question is best answered by Drew or Langdon, by the way, and would look a little something like this:
dbconnect();
function validate_age($age)
{
if ($age > 0 OR $age < 110) { $flag = 0; }
else { $flag = 1; }
return $flag;
}
$result = mysql_query("SELECT * FROM dpc_users WHERE EXISTS age");
while ($row = mysql_fetch_array($result))
{
if (validate_age($row[age]))
{
$count++;
$total = $total + $row[age];
}
}
$avg = round($total / $count);
echo ("The average DPC user is $avg years old");
?>
... That would save this thread from running for all eternity as well...
- haje
(edit: Sorry about the BFugly formatting of my sourcecode, and definitely sorry for the lack of code optimization - I whacked this out in 2 minutes without testing it.)
I am probably the oldest person on here. I am not going to tell you how old I am
but I will say I have been retired for 9 years. I am not going to say how old I was
when I retired but will say I was already old. I am definitely an amateur photographer.