In my database I have a field with a set birthdate (e.g. 1989.08.10 (YYYY.MM.DD)). I also have a function that converts this info to the correct year (e.g. 17, 22, 30 years). In the search engine I'm making I have a query built up from the various inputs which are required by the user, whereas two of these are the age, MIN and MAX. For example, select all ages between 18-25.
My problem is that I'm not sure how I'm supposed to get the finished results as I can't imagine how to add it to a query. I presume I will have to make two WHILE loops somehow which would look like this for the finished result:
while($row = mysql_fetch_array($query){
$age = convertFunc($row['birthdate']);
while(XXXXX){
SOME CODE HERE
}
}
I'm quite lost on this, but to clarify. Exactly what I want is something similar to this in a search query against the database: SELECT * FROM users WHERE user = '$name' AND fromAge >= 18 AND toAge <= 25
This would select all the fields with the corresponding age to MIN and MAX.