sql - Filter age from database using PHP -


I have a database that has a series of people with an age group. Age data in the database looks like 6 months for 6 months, 5 years for 5 years and so on. I need to be able to filter my data, so I can only see a group less than 5 years old. What it looks like on my PHP minute

  $ query = "Remember the difference code, the minimum angle, with the description that start-up =" age "code by command"; While ($ line = mysql_fetch_array ($ result)) {if ($ line ['minimumage']   

In the minute if you have a person of 6 meters, then this will not appear because the number is greater than 5, how can I include information for someone below it 5y but older than 5m?

If you select '5y' or '4y' or '4y 3m' or ' 9m 'and likewise you can use the REGEXP operator in the selection code ():

  $ query = "select the difference code, the minimum angle, details Reminds where the starting place = 'age' and minimum save 'REGEXP' ^ ([0-5] y | [0- 9] m) | ([0-5] y [0- 9] m) & amp; Order by code ";    

Comments