<?php

include '../db_connect.php';

$userid = $_POST['userid']; 

 $con = dbConnect();

$sql = "SELECT COUNT(*) AS total FROM notification_table WHERE notice = 'true' AND userid = '$userid'";
$result = mysqli_query($con, $sql);

$response = array();

if ($row = mysqli_fetch_assoc($result)) {
    $response['total'] = $row['total'];
} else {
    $response['total'] = 0;
}

echo json_encode($response);

?>
