title: How to filter by price ranges in PHP / MySQL?
body: <p>I'm trying to create a function that will filter out products based on price ranges.</p>
  
  <p>A user can select more price ranges at once (via checkboxes). The checkboxes looks like this:</p>
  
  <pre><code>    &lt;label&gt;0-500 &lt;input type="checkbox" name="price[]" value="1"/&gt;&lt;/label&gt;
      &lt;label&gt;500-1000 &lt;input type="checkbox" name="price[]" value="2"/&gt;&lt;/label&gt;
      &lt;label&gt;1000-2000 &lt;input type="checkbox" name="price[]" value="3"/&gt;&lt;/label&gt;
  </code></pre>
  
  <p>When the user submits the filter form with 2 checkboxes checked, it sends me an array which looks like this <code>[0 =&gt; "2", 1 =&gt; "3"]</code>. </p>
  
  <p>Then I'd filter the products via SQL query (<code>SELECT * FROM ... WHERE price &gt; 500 AND price &lt; 2000</code> // very simplified).</p>
  
  <p>The thing is I don't know <strong>how to properly get those price ranges from the array</strong>, which doesnt include it specifically.</p>
  
  <p>I would highly appreciate your help.
  Thanks in advance! </p>