php - codeigniter Internal Server Error when move to real server -


i have problem when move codeigniter app real server

error:

php fatal error: call member function result_array() on boolean in /helper/application/models/team_model.php on line 41

code:

    return $this->db->get()->result_array(); 

whole code :

    function __construct(){          $this->load->database();     }   function select_data($field , $table , $where = '' , $join_array = '' , $limit = '' , $order = ''){      $this->db->select($field);     $this->db->from($table);      if($where != ""){          $this->db->where($where);     }      if($join_array != ''){         if(in_array('multiple',$join_array)){             foreach($join_array['1'] $joinarray){                 $this->db->join($joinarray[0], $joinarray[1]);             }         }else{             $this->db->join($join_array[0], $join_array[1]);         }     }      if($limit != ""){         if(count($limit)>1){             $this->db->limit($limit['0'] , $limit['1']);         }else{             $this->db->limit($limit);         }      }      if($order != ""){         $this->db->order_by($order['0'] , $order['1']);     }     return $this->db->get->result_array();     die(); } 

i tested this, , works me based on database. if doesn't work you, i'd need know more database, , how using it. ran going /test, maybe /index.php/test. depends on config.

<?php if( ! defined('basepath') ) exit('no direct script access allowed');  class test extends ci_controller{      public function __construct()     {         parent::__construct();          $this->load->database();     }      // -----------------------------------------------------------------------      /**      * testing select_data method      */     public function index()     {         var_dump($this->select_data(             '*',              'users',              ['username' => 'briang'],             ['auth_sessions', 'users.user_id = auth_sessions.user_id'],             1,             ['users.user_id','asc']         ));     }      // -----------------------------------------------------------------------      public function select_data( $field , $table , $where = '' , $join_array = '' , $limit = '' , $order = '' ){           $this->db->select($field);         $this->db->from($table);          if($where != "")             $this->db->where($where);          if($join_array != ''){             if(in_array('multiple',$join_array)){                 foreach($join_array['1'] $joinarray){                     $this->db->join($joinarray[0], $joinarray[1]);                 }             }else{                 $this->db->join($join_array[0], $join_array[1]);             }         }          if($order != "")             $this->db->order_by($order['0'] , $order['1']);          if($limit != ""){             if(count($limit)>1){                 $this->db->limit($limit['0'] , $limit['1']);             }else{                 $this->db->limit($limit);             }         }          $query = $this->db->get();          return $query->num_rows() > 0              ? $query->result_array()             : null;     }  }  /* end of file test.php */ /* location: /application/controllers/test.php */ 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -