title: codeigniter- search and display data from database
body: <p>I am trying to display data from database to the view but I am unable to do so. 
  the problem I am having is that how do I display the data in a table tag while connecting it with the controller. </p>
  
  <p>View:</p>
  
  <pre><code>&lt;form action="#" class="login-wrapper" method="get"&gt;
      &lt;div class="span12" align="center"&gt;
       &lt;input class="input span12 password" type="text" name="search" placeholder="search by name"&gt;
      &lt;div class="actions"&gt;
       &lt;input class="btn btn-danger" type="submit" name="sub" value="search now"&gt;
      &lt;/div&gt;
      &lt;/div &gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Controller: </p>
  
  <pre><code>public function select ($search){
  
      $this-&gt;load-&gt;model('Login_model');
  
      if(isset($_GET ['search']) &amp;&amp; !empty($_GET['search'])) {
  
          $search= $_GET[ 'search'];
          $this-&gt;load-&gt;model('Login_model');
  
          if($this-&gt;Login_model-&gt;selectorganizer($search))
          {
             $this-&gt;load-&gt;view('organizer');
  
          }
          else
          {
              redirect('admin/show');
          }
      }  
  } 
  </code></pre>
  
  <p>Model: </p>
  
  <pre><code>public function selectorganizer ($search) {
      $condition = "search = '" . $search . "'";
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('organizer');
      $this-&gt;db-&gt;where($condition);
      $query = $this-&gt;db-&gt;get();
      return $result = $query-&gt;result();
  }          
  </code></pre>