I think that is going to be asy (if you can) to change a bit the data model and add to numeric fields for the range for example:
| MIN_AGE | MAX_AGE |
5 10
11 18
so you can do a select between the two values.
Aswell i recomend you to not use the same value for two blocks, for example, if you have 5-10 the next should be 11-18.
If you cant change the data model i will probably get the data and process it in the PHP or make some king of stored procedure in the database to process de thing, but this is a non trivial task.
EDIT 1:
If you have not too many ranges you can get all of them to your PHP code and afer convert the "5-10" string in two integers using this expresion:
"""
^ # Assert position at the beginning of a line (at beginning of the string or after a line break character)
( # Match the regular expression below and capture its match into backreference number 1
[0-9] # Match a single character in the range between “0” and “9”
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
)
- # Match the character “-” literally
( # Match the regular expression below and capture its match into backreference number 2
[0-9] # Match a single character in the range between “0” and “9”
+ # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
)
$ # Assert position at the end of a line (at the end of the string or before a line break character)
"""
^([0-9]+)-([0-9]+)$
This way you ar goint to get two capture groups, group 1 with the min and group 2 with the max value. At this point is easy to check if the value you have is in the range.
I hope this make sense for you, please let me know if not :)