<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
require_once('../lib/dbclass.php');






$data = findQuery('SELECT tbl_club.club_name,sum(tbl_transaction.Received) Received
    FROM tbl_transaction
   inner join tbl_club on tbl_club.id=tbl_transaction.clubid where tbl_transaction.Received>0 group by tbl_club.club_name order by Received desc');

if ($data) {
    $message = 'true';
    for ($i = 0;$i < count($data);$i++) {
        $data2[] = [



'name'   => $data[$i]['club_name'],
'amount' => $data[$i]['Received'],


];
    }
} else {
    $message = 'false';
    $data2[] = ['error' => 'Not Found'];
}


echo json_encode(['Status' => $message, 'data' => $data2]);

return;

?>

