I need help to be able to sum "total_attendance table column" by user id weekly starting from Sunday and echo it out.
This week's output should override last week's output, while next week's output should override this week's output on and on like that
Below is the code i already wrote for this
I got this error.
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in ….
Beyond the error, please i need a working code.
Thanks as always
<?php $result = mysqli_query($con, "SELECT SUM(totalattn) FROM
attendance GROUP BY yearweek(date, 0) WHERE user_id='$user_id'");
while ($row = mysqli_fetch_assoc($result)) {
$totalattn = $row['totalattn'];
echo $totalattn;
}
?>