title: Query for search filtering is not outputting values unless specified in input field
body: <p>I am trying to create a search filter query that displays results based on full name, age, country and state. Everything works fine except one little problem with regards to filtering by age. Just for reference, I'm grabbing a <code>min_age</code> and <code>max_age</code> and want to return anyone between the given range. If someone doesn't input any values in the any of the fields then I want all people to show up from the database, which works fine except the age part. </p>
  
  <p>I have people in the database who are 0 years old and some older. If no input values are given, all people who are 0 years old will display. Those who are older, a <code>min_age</code> and <code>max_age</code> is required for them to display (and I don't want this, I want all people to show up).</p>
  
  <p>P.S. The following query is written in php and the format is for your readability only :)</p>
  
  <p>Thank you for any help!</p>
  
  <pre><code>$query = "SELECT 
                CONCAT_WS(' ', person.given_name, person.family_name) AS 
                full_name, 
                TIMESTAMPDIFF(YEAR, person.date_of_birth, CURDATE()) AS age, 
                country.name AS country, 
                state.name AS state 
            FROM 
                person INNER JOIN 
                country ON country.country_id = person.country_id INNER JOIN 
                state ON state.state_id = person.state_id 
            WHERE 
                CONCAT_WS(' ', person.given_name, person.family_name) LIKE ? AND 
               (TIMESTAMPDIFF(YEAR, person.date_of_birth, CURDATE()) BETWEEN ? 
                AND ?) AND 
                country.name LIKE ? AND 
                state.name LIKE ?";
  
  $result = $this-&gt;database-&gt;query($query, ["$playerName%", $playerAgeMin, $playerAgeMax, "$countryName%", "$stateName%"]);
  </code></pre>
  
  <p>Here is an example:</p>
  
  <ul>
  <li>John Smith, <strong>26</strong>, Australia, Queensland</li>
  <li>Earl Johnson, <strong>0</strong>, Australia, New South Wales</li>
  <li>Tim Donovan, <strong>0</strong>, New Zealand, Auckland</li>
  <li>Judy Flores, <strong>25</strong>, New Zealand, Otago</li>
  </ul>
  
  <p>if no values are given for any input fields, which are: 
  'Given Name', 'Family Name', 'Min Age', 'Max Age', 'Country', 'State', 
  then <code>Earl Johnson</code> and <code>Tim Donovan</code> will display but not <code>John Smith</code> or <code>Judy Flores</code>. </p>
  
  <p>If I put age range between <code>20</code> and <code>30</code> then both <code>John Smith</code> and <code>Judy Flores</code> will display.</p>
  
  <p>So again, if no values are specified in the input fields, I want everyone to display.</p>