title: How to execute a WHERE clause in a view with codeigniter
body: <p>I am trying to show some data coming from a database in a page (VIEW) using the WHERE clause as a variable.</p>
  
  <p>The select is pretty simple:</p>
  
  <pre><code>SELECT * FROM table WHERE terms = $term;
  </code></pre>
  
  <p>In the model I have created following code:</p>
  
  <pre><code>class Get_collection_data extends CI_Model {
  
  public function get_terms ($term){
  $query = $this-&gt;db-&gt;query("SELECT * FROM table WHERE terms =  '$term");
  return $query;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>class Admin_collection extends CI_Controller {
  
  function __construct(){
  parent::__construct();
  
  $this-&gt;load-&gt;model('get_collection_data');  
  }
  
  
  $data['house_items'] =  $this-&gt;get_collection_data-&gt;get_terms($term);
  </code></pre>
  
  <p>Obviously the script does not work.
  My question is: how can I pass the $terms in the view? $term has different values which I can get directly from the view. How can I execute the WHERE clause in the view?</p>