Welcome Guest, Not a member yet? Register   Sign In
Undefined property: CodeIgniter\View\View::$db
#1

(This post was last modified: 01-16-2021, 05:07 PM by yuma2020.)

Hi, need help to solve this problem: 
ErrorException
PHP Code:
Undefined propertyCodeIgniter\View\View::$db 
PHP Code:
$this->db->limit 
Need create query to present here:
PHP Code:
90             $this->db->limit(9);
91             $categories $this->db->get_where('category', array('parent' => 0))->result_array(); 
My proporsal to query is:
PHP Code:
      public function getCategoriesNine($category_id 0) {
        $getTable $this->db->table('category')->get();
        if ($category_id 0) {
          $query $this->db->table('category', array('parent' => 0))
          ->where(['id' => $category_id ])
          ->limit(9)
          ->get()
          ->getFirstRow();
          return $query $query null;
        }
        return $getTable $getTable  null;
      

Please need help if valir of query parse
PHP Code:
->limit(9

present in the view is this proporsal
PHP Code:
                            $queryCatNine = (new \App\Models\CommonQueries())->getCategoriesNine();
                            
$categories $queryCatNine->getResultArray(); 
or I'd like to know how to define this property.

Update example need know is valid in the view:
PHP Code:
                            $queryCat = (new \App\Models\CommonQueries())->getCategoriesNine();
                            
$categories $queryCat->getResultArray();
                            
$categories->limit(10); 
Reply


Messages In This Thread
Undefined property: CodeIgniter\View\View::$db - by yuma2020 - 01-16-2021, 04:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB