First - I would change "day,month,year" to a date field called 'birthdate'.

Then on the screen that the user chooses what to search for you let them 
enter 1 or 2 or 3 values: the 'name', the 'city' or the 'age' (in years).

Then when you process that input, you determine what they entered - 1 or 2 
or 3 things and build a WHERE clause based on 1 or 2 or 3 things.

For the Age filter you take it and subttract it from today's date (call it 
'filterdate') and use the resulting date to say "birthdate >= filterdate"

Once you have your where clause built, you build your query and add the 
where clause to it, like this:

$query = "SELECT * FROM $mydatabase WHERE $my_where_clause ORDER BY id DESC"

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to