builder()->where('business_id ', $business_id); // Filter by business_id $query = $this->builder()->get(); // Use findAll() instead of get() return ($query->getResult()); } public function setTable($tableName) { $this->table = $tableName; return $this; } public function insertData($table, $data) { try { $this->db->table($table)->insert($data); $last_insert_id = $this->db->insertID(); return ["info"=>$last_insert_id,"err"=>""]; } catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) { return ["info"=>"","err"=>'Database operation failed: ' . $e->getMessage()]; } catch (\Exception $e) { return ["info"=>"","err"=>'An error occurred: ' . $e->getMessage()]; } } public function updateData($table, $data, $where) { try { $this->db->table($table)->update($data, $where); $affected_rows = $this->db->affectedRows(); return ["info"=>$affected_rows." Affected","err"=>""]; } catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) { return ["info"=>"","err"=>'Database operation failed: ' . $e->getMessage()]; } catch (\Exception $e) { return ["info"=>"","err"=>'Database operation failed: ' . $e->getMessage()]; } } } ?>