title: Code Igniter SQL Query: how to create this query
body: <p>This is the first time I will be using a MVC and i have read the documentation of code igniter.. but i cant seem to get this query right:</p>
  
  <pre><code>$score = $_POST['time'];
  $sql = "SELECT COUNT(score) as c FROM highscores WHERE score &lt; '$score' ORDER BY score ASC LIMIT 10";
  $result = mysqli_query($con, $sql);
  $count = mysqli_fetch_object($result)-&gt;c;
  if(!is_null($count) &amp;&amp; $count &lt; 10) {
      echo 1;
  }
  </code></pre>
  
  <p>and then my code igniter version:</p>
  
  <pre><code>public function insert_highscore($score) {
      $this-&gt;db-&gt;select('COUNT(score) as c')-&gt;from('highscores')-&gt;where('score &lt; ' . $score);
      $query = $this-&gt;db-&gt;get();
      $count = $query-&gt;c;
      if(!is_null($count) &amp;&amp; $count &lt; 10) {
          echo 1;
      }
      return $count;
  }
  </code></pre>
  
  <p>and i call that function like so:</p>
  
  <pre><code>public function index()
  {
      $this-&gt;load-&gt;view('header');
      $this-&gt;load-&gt;model('highscores_model');
      $data = $this-&gt;highscores_model-&gt;get_highscores();
      $this-&gt;highscores_model-&gt;insert_highscore("00:00:01.11");
      foreach($data as $highscore){
          echo $highscore['name'];
          echo $highscore['score'];
      }
      $this-&gt;load-&gt;view('footer');
  }
  </code></pre>
  
  <p>and getting this error</p>
  
  <pre><code>Error Number: 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 ':00:01.11' at line 3
  
  SELECT COUNT(score) as c FROM (`highscores`) WHERE `score` &lt; 00:00:01.11
  
  Filename: /storage/websites/cambist_app/codeigniter/models/highscores_model.php
  
  Line Number: 15
  </code></pre>
  
  <p>Any Help Greatly Appreciated</p>