title: Codeigniter search function throws an error
body: <p>I have written some code to make a search in the CODEIGNITER3 framework. When I insert 2 or more words to search input, it works great, however, when I enter just 1 word, it gives this error. </p>
  
  <p><a href="https://i.stack.imgur.com/gdOFh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gdOFh.png" alt="enter image description here"></a></p>
  
  <p>How can I solve this problem?
  Here is my controller:</p>
  
  <pre><code>function search() {
              $keyword = strip_tags($this-&gt;input-&gt;get('searchforcourses'));
              $keyword = explode(" ", $keyword);
  
              $data['title'] = 'Bütün Kurslar Burada';
              $data['courses'] = $this-&gt;courses_model-&gt;courses_search($keyword);
  
  
              $this-&gt;load-&gt;view('templates/header');
              $this-&gt;load-&gt;view('courses/courses', $data);
              $this-&gt;load-&gt;view('templates/footer');
          }
  </code></pre>
  
  <p>And here is my model: </p>
  
  <pre><code>function courses_search($keyword) {
              $this-&gt;db-&gt;select('*');
              $this-&gt;db-&gt;from('courses');
              $this-&gt;db-&gt;like('title',$keyword[0]);
              $this-&gt;db-&gt;or_like('title',$keyword[1]);
              $this-&gt;db-&gt;join('instructors', 'instructors.id = courses.instructor_id', 'left');
              $this-&gt;db-&gt;join('categories', 'categories.id = courses.category_id', 'left');
              $query = $this-&gt;db-&gt;get();
              return $query-&gt;result_array();
          }
  </code></pre>
  
  <p>Thanks in advance!</p>