title: How to filter results based on age from MySQL database
body: <p>I have a database setup with user info including name, email, dob, gender, website and other info.</p>
  
  <p>I am trying to implement filter result options for the user page.</p>
  
  <p>The problem is i don't know how to filter by age, since i am storing the age value as a date of birth, i have a php function to get age from it, but how do i go about this.</p>
  
  <p>The filter option is age : 12-24, 25-32, 33-56 (in years)</p>
  
  <p>How do i do like this? <code>select * from users where user.age &lt;= 20 and &gt;= 20</code> i don't even have a age column, all i have is date of birth.</p>
  
  <p>The filter is stored in session variable <code>$_SESSION['age'] = 12-24</code> How do i get the first value (12) and the last value (24) from session and later filter so that the age should be greater than 12 and less than 24</p>
  
  <p>Please help me out.</p>