EVOLUTION-NINJA
Edit File: User.php
<?php namespace App\Controllers; class User extends BaseController{ public function __construct() { date_default_timezone_set('Asia/Kolkata'); $this->db = \Config\Database::connect(); } public function user_details(){ $promoter_id = session()->get('id'); $builder = $this->db->table('Customers'); $builder->select('Customers.*, payments.promoter_id,payments.scheme,payments.user_id, SUM(payments.amount) as total_amount'); $builder->join('user', 'user.id = promoter_payments.promoter_id', 'left'); $builder->join('user_details', 'promoter_payments.promoter_id = user_details.user_id', 'left'); $builder->where('promoter_payments.promoter_id', $promoter_id); // $builder->groupBy('promoter_payments.scheme, promoter_payments.promoter_id, promoter_payments.user_id'); $data = $builder->get()->getRowArray(); // print_r($data);die(); return $this->response->setJSON($data); } }?>