title: PDO pagination syntax violation error
body: <p>Can someone please check out whats wrong with my script below.</p>
  
  <p>i'm getting "PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 ''0', '1'' at line 1'"</p>
  
  <pre><code>    $limit = 1;
  $p=$_GET['p']=="" ? 1:$_GET['p'];
  
  $start=($p-1)*$limit;
  
  
  $sa_stmt = $db-&gt;prepare('SELECT * FROM members WHERE referral=:username ORDER BY memberID LIMIT :start, :limit');
  
  
  $sa_stmt-&gt;execute(array(
                  ':username' =&gt; $_SESSION['username'],
                  ':start' =&gt; $start,
                  ':limit' =&gt; $limit
              ));
  
  while($info = $sa_stmt-&gt;fetch(PDO::FETCH_ASSOC)){ 
   $norec = "yes";
  echo ''.$info["username"] . '    '; }
  
  
  $count=$db-&gt;prepare("SELECT COUNT(memberID) FROM members WHERE referral=:username ORDER BY memberID");
  $count-&gt;execute(array(':username' =&gt; $_SESSION['username']));
  $count=$count-&gt;fetchColumn();
  
  $countP=(ceil($count/$limit)) + 1;
  $tW=($countP*50) + $countP;
  echo"&lt;center style='overflow-x:auto;margin-top:10px;padding-bottom:10px;'&gt;";
   echo"&lt;div style='width:".$tW."px'&gt;";
   for($i=1;$i&lt;$countP;$i++){
    $isC=$i==$_GET['p'] ? "b-green":"";
    echo "&lt;a href='?p=$i'&gt;&lt;button class='pgbutton $isC'&gt;$i&lt;/button&gt;&lt;/a&gt;";
   }
   echo"&lt;/div&gt;";
  echo"&lt;/center&gt;";
  </code></pre>