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

(This post was last modified: 01-19-2021, 07:51 AM by nicojmb.)

This function not its optimal, always get  all rows in category tables though the $category_id is set.

I would trade it for this:

PHP Code:
public function getCategoriesNine($category_id 0
{
  $categories $this->db->table('category');

  if ($category_id 0
  {
        // Limit 10?  getFirtsRow??? i dont understand this...
        return $categories->where(['id' => $category_id ])->limit(10)->get()->getFirstRow();
  }

  return $categories->get();

Reply


Messages In This Thread
RE: Undefined property: CodeIgniter\View\View::$db - by nicojmb - 01-19-2021, 07:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB