title: MySQL Error 1064 Using LIMIT Clause
body: <p>I'm having a strange issue running a query via PDO prepared statements that I just can't spot the issue. When running the query manually it works just fine. Here is the code (simplified for conciseness):</p>
  
  <pre><code>// Query Parameters
  $params = array( 1, 5 );
  
  // Get Products
  $query = "SELECT * FROM mydb.Product
            WHERE ProductId &gt;= ?
              AND IsApproved = 1
              AND IsPublic = 1
            LIMIT ?";
  
  // Get Database Instance
  $dbh = App\App::getDatabase()-&gt;getInstance();
  
  // Prepare Query
  if( $stmt = $dbh-&gt;prepare($query) )
  {
     if( $stmt-&gt;execute($params) )
     {
         // Return Records
     }
  }
  </code></pre>
  
  <p>Removing the <code>LIMIT ?</code> portion from the query returns all results as expected. Instead, when attempting to use the LIMIT and it passes <strong>5</strong> as the value, I get this error:</p>
  
  <blockquote>
    <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''5'' at line 5</p>
  </blockquote>
  
  <p>A dump of the <strong>PDOStatement</strong> object after preparation shows:</p>
  
  <pre><code>object(PDOStatement)[59]
      public 'queryString' =&gt; string 'SELECT * FROM mydb.Product
         WHERE ProductId &gt;= ?
         AND IsApproved = 1
         AND IsPublic = 1
         LIMIT ?'
  </code></pre>
  
  <p>I've tried putting a semicolon at the end of the query but that gives same error. Am I having cerebral flatulence and missing something obvious?</p>
  
  <hr>
  
  <p><strong>TL;DR;</strong> Why does my prepared statement fail when using the LIMIT clause with a 1064 error?</p>