<?php

// --- Money Out ------
$out  = mysqli_query($con, "SELECT SUM(balance) as total FROM `transactions`
WHERE username = '$username' && trans_type='Debit'") or die(mysqli_connect_error());
$x = mysqli_fetch_assoc($out);
$money_out = $x['total'];


// --- Money In ------
$in  = mysqli_query($con, "SELECT SUM(balance) as total FROM `transactions`
WHERE (trans_type='Deposit' OR trans_type='Credit') AND username = '$username'") or die(mysqli_connect_error());
$y = mysqli_fetch_assoc($in);
$money_in = $y['total'];

// --- Notification Count ------
$notify  = mysqli_query($con, "SELECT * FROM `notifications` 
WHERE username = '$username'") or die(mysqli_connect_error());
$notification_counts =  mysqli_num_rows($notify);

// --- Wallet Address ------
$add  = mysqli_query($con, "SELECT * FROM `wallet_address` 
WHERE id = '1'") or die(mysqli_connect_error());
$add = mysqli_fetch_assoc($add);
$walletAddress = $add['coinAddress'];

// --- Unread Messages ------
$notif  = mysqli_query($con, "SELECT * FROM `notifications` 
WHERE username = '$username' AND status ='0'") or die(mysqli_connect_error());
$unread_notification =  mysqli_num_rows($notif);
