I have tried to add a check to get the member ID but it is still showing every users data.
Code: Select all
<?php
$connection = mysqli_connect('localhost', 'root', '', 'farmrex');
$result = mysqli_query($connection, "SELECT
DATE_FORMAT(expense_date, '%b') AS month,
SUM(cost) AS total
FROM
expenses
left join membership_userrecords on pkValue=expenses.id
WHERE
expense_date > NOW() - INTERVAL 12 MONTH
and memberID='".getLoggedMemberID()."'
GROUP BY
YEAR(expense_date), MONTH(expense_date)");
//if($result){
// echo "CONNECTED";
//}
?>