On Jan 6, 12:38 am, "Skybuck Flying" wrote:
>
> I want to select people from a database within a certain
> age range.
So what's the problem? Compute the range of birth dates on the client
side and stick them into your query...
> For example:
>
> Select * From TablePerson Where (Age(Birthdate) > 20) and
> (Age(Birthdate) < 9
>
> That would make it really easy.
What's wrong with this (in PHP):
$low = date('Y-m-d', strtotime('98 years ago'));
$high = date('Y-m-d', strtotime('20 years ago'))
$query = "SELECT * FROM `TablePerson` WHERE " .
"`Birthdate` > '{$low}' AND `Birthdate` < '{$high}'";
$result = mysql_query($query);
I really don't see what the problem is...
Cheers,
NC