title: PHP PDO usage with MySQL BETWEEN and INET_ATON()
body: <p>I started a PHP side project a while back, and recently started cleaning up all the code and updating it. Part of that is moving things to start using PDO for DB queries.  In one particular query I have a <code>WHERE</code> clause statement that uses the <code>BETWEEN</code> clause along with the <code>INET_ATON()</code> function. So far I have not been able to get this to work properly and would appreciate if anyone can point out whether or not it will even work.</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/12514357/pdo-and-mysql-between">this</a> question which leads me to believe that the <code>BETWEEN</code> statement is not having any issues, but I fear it might be the combination with the function causing the issue.</p>
  
  <p>Here is what that portion of my query looks like:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT foo, bar FROM table JOIN more_table 
  WHERE item1 = :value AND ip_address BETWEEN INET_ATON(:ipstart) AND INET_ATON(:ipend)
  </code></pre>
  
  <p>The actual query is quite a bit larger than that, but for basics this works. To replace the tokens with the actual values I have the following foreach loop set up (the <code>var_dump</code> is just there so i can verify the correct values are getting passed in, which they are):</p>
  
  <pre><code>foreach($p as $k=&gt;$v) {
      echo var_dump($k, $v);
      if(is_int($v)){
          $querySubmit-&gt;bindValue($k, $v, PDO::PARAM_INT);
      } else {
          $querySubmit-&gt;bindValue($k, $v, PDO::PARAM_STR);
      }
  }
  </code></pre>
  
  <p>If anyone knows whether <code>PDO::Prepare</code> and <code>PDO::bindValue</code> have any limitations with a query set up to use <code>BETWEEN</code> and <code>INET_ATON()</code>, I would greatly appreciate knowing!</p>