title: How to fetch a single result from mysql using code igniter?
body: <p>Having trouble with Codeigniter. I am trying to fetch the value of a product from mysql. The mysql table contain a field called <code>cost_price</code>. I am trying to fetch the result of a single product using the product ID. Here is the code im using, </p>
  
  <pre><code>$query = $this-&gt;db-&gt;query('SELECT * FROM items WHERE id="$id"');
  $row = $query-&gt;result();
  echo $row['cost_price']; 
  </code></pre>
  
  <p>But nothing is happening ! What is the problem with my code? </p>
  
  <p>I tried some wrong code to check whether the database is responding or not, but it seems that the database is working fine. Can't understand why my query can't find any result ! </p>