title: Object of class CI_DB_mysqli_result could not be converted to string
body: <p>here is my code :</p>
  
  <pre><code>class Mymodel extends CI_Model {
  
  public function getinstitution()
      {
      $course = "programming";
      $location = "jakarta";
      $price = "price2";
  
      $data = $this-&gt;db-&gt;query('SELECT * FROM coursesplace WHERE 1=1');
  
      if($course)     $data .= "AND course=\"$course\" ";
      if($location)   $data .= "AND location=\"$location\" ";
      if($price)      $data .= "AND price=\"$price\"";
  
      return $data-&gt;result_array();
      }
  }
  </code></pre>
  
  <p>I want to filter computer course places based on three variables (course, location and price), with string data type. I have "programming", "jakarta", and "price2" for example.</p>
  
  <p>But, then I have this error :</p>
  
  <p><strong>A PHP Error was encountered</strong></p>
  
  <p><strong>Severity: 4096</strong></p>
  
  <p><strong>Message: Object of class CI_DB_mysqli_result could not be converted to string</strong></p>
  
  <p><strong>Filename: models/mymodel.php</strong></p>
  
  <p><strong>Line Number: 14</strong></p>
  
  <p>---> Line 14 is :</p>
  
  <pre><code>if($course)     $data .= "AND course=\"$course\" ";
  </code></pre>
  
  <p>AND other error :</p>
  
  <p><strong>A PHP Error was encountered</strong></p>
  
  <p><strong>Severity: Error</strong></p>
  
  <p><strong>Message: Call to a member function result_array() on a non-object</strong></p>
  
  <p><strong>Filename: models/mymodel.php</strong></p>
  
  <p><strong>Line Number: 18</strong></p>
  
  <p>---> Line 18 is :</p>
  
  <pre><code>return $data-&gt;result_array();
  </code></pre>
  
  <p>What should I do? Thanks for the answer !</p>