title: Search Query in codeigniter
body: <p>I am new in codeigniter. I want to create a search bar where user write some keyword and it will check in all fields of table in database and then show relative result.</p>
  
  <p><strong>Here is my code of View:</strong></p>
  
  <pre><code>&lt;?php
  
      echo '&lt;h2&gt;Search Books&lt;/h2&gt;';
      echo form_open('site/search');?&gt;
  
  &lt;p&gt;
  &lt;label for="title"&gt; Title:&lt;/label&gt;
   &lt;input type="text"  placeholder="Search" name="search" size="50%"&gt;
  &lt;/p&gt;
  &lt;input type="submit" value="Submit"/&gt;
      &lt;?php echo form_close(); ?&gt;
  
  &lt;!--Here will be Search Result--&gt;
  &lt;?php if (isset($searches)): foreach($searches as $search):?&gt;
  &lt;h4&gt;&lt;?php echo " &amp;nbsp ";
  echo $search-&gt;book_name;
  echo " &amp;nbsp "; ?&gt;&lt;/h4&gt;
  &lt;?php endforeach; ?&gt;
  &lt;?php else: ?&gt;
  No Book Found
  &lt;?php endif;?&gt;
  </code></pre>
  
  <p><strong>And the controller code with name site is</strong></p>
  
  <pre><code>function search(){
  
              $search_book = array (
                              $search= $this-&gt;input-&gt;post('search')
              );
              $this-&gt;users_model-&gt;user_search($search_book);
              $this-&gt;dashboard();
  </code></pre>
  
  <p><strong>Query Result in Controller</strong></p>
  
  <pre><code>if ($query = $this-&gt;users_model-&gt;user_search())
              {
  
                  $search['searches'] = $query;
              }
              $data = $search;
               $this-&gt;load-&gt;view('dashboard', $data);
  </code></pre>
  
  <p><strong>Here is Model Code:</strong></p>
  
  <pre><code>function user_search($search_book){
  
                   $query = $this-&gt;db-&gt;like('book_name', $search_book);
               $this-&gt;db-&gt;or_like('author', $search_book);
                $this-&gt;db-&gt;or_like('date', $search_book);
               $this-&gt;db-&gt;get('books');
                  return $query-&gt;result();
  </code></pre>
  
  <p><strong>Error Shown</strong></p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Warning</p>
    
    <p>Message: Missing argument 1 for Users_model::user_search(), called in
    C:\xampp\htdocs\Pure_Logics\application\controllers\site.php on line
    28 and defined</p>
    
    <p>Filename: models/users_model.php</p>
    
    <p>Line Number: 26</p>
    
    <p>Backtrace:</p>
    
    <p>File: C:\xampp\htdocs\Pure_Logics\application\models\users_model.php
    Line: 26 Function: _error_handler</p>
    
    <p>File: C:\xampp\htdocs\Pure_Logics\application\controllers\site.php
    Line: 28 Function: user_search</p>
    
    <p>File: C:\xampp\htdocs\Pure_Logics\index.php Line: 315 Function:
    require_once</p>
  </blockquote>