One solution is to do all the work in MySQL and inject your variables into your MySQL statement
To do that you will need a combination of these answers
1) Get the date from x years ago
Selecting all records from one year ago till now
2) Select results between date range
Select mysql query between date?
You should end up with a query something like this:
select *
from *table_name*
where *datetime_column*
between DATE_SUB(NOW(),INTERVAL 22 YEAR)
and DATE_SUB(NOW(),INTERVAL 33 YEAR);
Note: you may need to add a year to the second date (33+1) to get the full range of someones age being 33 (you are 33 until the day you turn 34)
Or if you prefer you can calculate your dates in JS, but depending how you do it you may need to format your dates so they will work in your query