title: Use of greater than or equals(>=) and lesser than or equals(<=) in SQL SELECT statements and PDO
body: <p>I have been trying to make a small function to determine grades from a set of ranges stored in a MySQL database  i.e A is between 80 and 100,A- is between 74 and 79 and so on. Am using PDO and prepared statements. However PDO does not give me the result. Could someone please help me resolve this.Below is the table preview</p>
  
  <p><img src="https://i.stack.imgur.com/bstbx.jpg" alt="table review"></p>
  
  <pre><code>&lt;?php
       include("./inc/db.php");
      //i have set PDO attribute to ERRMODE_EXCEPTION in the connection file
      //this code has failed to work
      $mark = 85;
  
      try{
          $pk = $db-&gt;prepare("SELECT * FROM grading WHERE ? BETWEEN min AND max");
          $pk-&gt;bindParam(1,$mark);
          $pk-&gt;execute();
          $ind=$pk-&gt;fetch(PDO::FETCH_ASSOC);
          echo $ind['grade'];
      } catch(PDOexception $f) {
          echo $f-&gt;getMessage();   
      }
  
  //however when i try this it displays the grade. whats wrong with the previous code?
  
      try{
          $pk = $db-&gt;prepare("SELECT * FROM grading WHERE 85 BETWEEN min AND max");
          $pk-&gt;execute();
          $ind=$pk-&gt;fetch(PDO::FETCH_ASSOC);
          echo $ind['grade'];
      } catch(PDOexception $f) {
          echo $f-&gt;getMessage();   
      }
   ?&gt;
  </code></pre>