(PHP) Extracting the correct birthdate when searching for age in a database -


in database have field set birthdate (e.g. 1989.08.10 (yyyy.mm.dd)). have function converts info correct year (e.g. 17, 22, 30 years). in search engine i'm making have query built various inputs required user, whereas 2 of these age, min , max. example, select ages between 18-25.

my problem i'm not sure how i'm supposed finished results can't imagine how add query. presume have make 2 while loops somehow finished result:

while($row = mysql_fetch_array($query){ $age = convertfunc($row['birthdate']); while(xxxxx){ code here } } 

i'm quite lost on this, clarify. want similar in search query against database: select * users user = '$name' , fromage >= 18 , toage <= 25

this select fields corresponding age min , max.

try like.

select * users datediff(birthdate,now()) between date_add(now(),interval -15 years) , date_add(now(),interval -25 years) 

Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -