diff --git a/app/Controllers/Subscription.php b/app/Controllers/Subscription.php index f756e390..f901f3ba 100644 --- a/app/Controllers/Subscription.php +++ b/app/Controllers/Subscription.php @@ -23,7 +23,8 @@ class Subscription extends BaseController $SubscriptionModel = new SubscriptionModel(); $data['page_name'] = 'Subscription Details'; // $data['subscriber'] = $SubscriptionModel->where($where)->findAll();; - $data['subscriber'] = $SubscriptionModel->getAllSubscribersWithNames($where); + $data['subscriber'] = $SubscriptionModel->getAllSubscribersWithNames($where); + $this->render_page('subscribers_list', $data); }else { diff --git a/app/Models/SubscriptionModel.php b/app/Models/SubscriptionModel.php index d4c2629b..bf3d1805 100644 --- a/app/Models/SubscriptionModel.php +++ b/app/Models/SubscriptionModel.php @@ -15,8 +15,8 @@ public function getAllSubscribersWithNames($where) { $builder = $this->db->table('subscription'); - $builder->select('subscription.*, schemes.scheme_name, CONCAT(customers.first_name, " ", customers.last_name) as customer_name'); - $builder->join('schemes', 'schemes.scheme_id = subscription.scheme_id'); + $builder->select('subscription.*, books.title, CONCAT(customers.first_name, " ", customers.last_name) as customer_name'); + $builder->join('books', 'books.book_id = subscription.scheme_id'); $builder->join('customers', 'customers.customer_id = subscription.customer_id'); $builder->where($where); return $builder->get()->getResultArray(); diff --git a/app/Views/subscribers_list.php b/app/Views/subscribers_list.php index af80d969..4d883c27 100644 --- a/app/Views/subscribers_list.php +++ b/app/Views/subscribers_list.php @@ -30,7 +30,7 @@ - + @@ -64,12 +64,12 @@ $uniqueSchemes = []; // Array to track unique scheme names foreach ($subscriber as $scheme) : // Check if the scheme name is already in the unique list - if (!in_array($scheme['scheme_name'], $uniqueSchemes)) { - $uniqueSchemes[] = $scheme['scheme_name']; // Add to unique list + if (!in_array($scheme['title'], $uniqueSchemes)) { + $uniqueSchemes[] = $scheme['title']; // Add to unique list ?>
- - + +