0 && in_array($type, ['cr', 'dr'])) { // Use prepared statements to prevent SQL injection $stmt = $con->prepare("INSERT INTO `tbl_wallet`(`type`, `amount`, `user_id`, `user_type`, `message`) VALUES (?, ?, ?, 'center', 'Action by Admin.')"); $stmt->bind_param("sdi", $type, $amount, $center_id); if($stmt->execute()) { echo ''; exit(); } else { echo '
Error adding fund: ' . $con->error . '
'; } $stmt->close(); } else { echo '
Invalid amount or type.
'; } } ?>
Wallet Balance
Rs.

Add Fund

Wallet History

prepare("SELECT * FROM `tbl_wallet` WHERE user_id = ? AND user_type = 'center' ORDER BY timestamp DESC"); $stmt->bind_param("i", $center_id); $stmt->execute(); $get = $stmt->get_result(); if($get->num_rows > 0) { while($row = $get->fetch_assoc()) { $is_credit = $row['type'] == 'cr'; $row_class = $is_credit ? 'credit-row' : 'debit-row'; $badge_class = $is_credit ? 'credit' : 'debit'; $amount_class = $is_credit ? 'credit' : 'debit'; $type_text = $is_credit ? 'Credit' : 'Debit'; $amount_prefix = $is_credit ? '+' : '-'; echo ''; } } else { echo ''; } $stmt->close(); ?>
# Type Amount Message Timestamp
#'.$i++.' '.$type_text.' '.$amount_prefix.' Rs. '.number_format($row['amount'], 2).' '.htmlspecialchars($row['message']).' '.date('d-m-Y H:i:s', strtotime($row['timestamp'])).'

No transactions found

No center selected. Please select a center first.'; } require_once 'includes/footer.php'; ?>