title: PHP PDO bindValue() don't work
body: <pre><code>&lt;?php
  try
  {
      $db = new PDO("mysql:host=localhost;dbname=DBNAME", "USER", "PASSWD");
  
      $stmt = $db-&gt;prepare("SELECT id, name FROM testdb ORDER BY time DESC LIMIT :index, 10");
      $stmt-&gt;bindValue(":index", $_GET['index'], PDO::PARAM_INT);
      $stmt-&gt;execute();
  
      while( $r = $stmt-&gt;fetch(PDO::FETCH_ASSOC) )
      {
          echo var_dump($r);                                      
      }
  
  }
  catch( PDOException $e )
  {
      die("Exception");
  }
  </code></pre>
  
  <p>The problem is on this line: <code>$stmt-&gt;bindValue(":index", $_GET['index'], PDO::PARAM_INT);</code></p>
  
  <p>And the specific parameter is the second one.</p>
  
  <p>The code as it is above doesn't work, it doesn't return anything so the while loop isn't executed. If I replace $_GET['index'] with a number, like 10, it works just fine, it returns 10 rows. Echoing $_GET['index'] displays a number, so it should pass a number. I've also tried bindParam, but the result is same.</p>
  
  <p>Why isn't this working?</p>
  
  <p>EDIT:</p>
  
  <p>Interesting... If I replace <code>$_GET['index'] with (int)$_GET['index']</code> it works. </p>