title: CodeIgniter: Function call result_array() gives error
body: <p>I'm getting this error for like a hour, what's this error on codeigniter </p>
  
  <p>Here is my model:</p>
  
  <p>i described property for fields too</p>
  
  <pre><code>class news_model extends CI_Model
  {
      public function __construct()
      {
          parent::__construct();  
          $this-&gt;load-&gt;database();
      }
  
      public function get_news($id = false)
      {
          if ($id === false) {
              $query = $this-&gt;db-&gt;query("SELECT tbl_news.id,
                                              tbl_news.fa_name,
                                              tbl_news.en_name,
                                              tbl_news.fa_shrt_name,
                                              tbl_news.en_shrt_name,
                                              tbl_news.fa_text,
                                              tbl_news.en_text,
                                              tbl_news.image,
                                              tbl_news.grp_id,
                                              tbl_news_grp.fa_name FROM tbl_news JOIN tbl_news_grp ON tbl_news_grp.id = tbl_news.id ");
  
              return $query-&gt;result_array();
          }
  
          $query = $this-&gt;db-&gt;get_where('tbl_news',array('id' =&gt; $id));
          return $query-&gt;result_array();
      }
  }
  </code></pre>
  
  <p>I get this error : </p>
  
  <pre><code>Fatal error: Call to a member function result_array() on a non-object in 
  C:\xampp\htdocs\ipkoroosh\application\models\news_model.php on line 19
  </code></pre>