prepare("SELECT first_name, last_name, account_number FROM members WHERE id = ?"); $memberStmt->bind_param("i", $memberId); $memberStmt->execute(); $member = $memberStmt->get_result()->fetch_assoc(); $memberStmt->close(); $txnStmt = $conn->prepare("SELECT type, amount, description, reference, created_at FROM transactions WHERE member_id = ? ORDER BY created_at DESC"); $txnStmt->bind_param("i", $memberId); $txnStmt->execute(); $transactions = $txnStmt->get_result(); $txnStmt->close(); if (isset($_GET['download']) && $_GET['download'] === 'csv') { header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="dream_sacco_statement_' . date('Y-m-d') . '.csv"'); $output = fopen('php://output', 'w'); fputcsv($output, ['Date', 'Type', 'Description', 'Reference', 'Amount']); $transactions->data_seek(0); while ($row = $transactions->fetch_assoc()) { fputcsv($output, [ date('Y-m-d H:i:s', strtotime($row['created_at'])), $row['type'], $row['description'], $row['reference'], $row['amount'] ]); } fclose($output); exit; } ?>
Account:
| Date | Type | Description | Reference | Amount |
|---|---|---|---|---|
| ETB |
No transactions found.