<?php 
require_once 'core.php';

date_default_timezone_set('Asia/Jakarta'); // set waktu di jakarta

$id_user = $_SESSION['user_id'];

$query  = "SELECT * FROM `txmessage_chat` WHERE `ftrecipient_msg` = '$id_user' AND fnstatus='1'";
$result = mysqli_query($link,$query); 
$count = mysqli_num_rows($result);
if($count > 0 ){$informasi = '<span class="badge badge-danger">'.$count.'</span>';}
?>

<a class="nav-link dropdown-toggle" href="#" Onclick="data_user()" id="messagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-toggle="tooltip" data-placement="bottom" title="Chat">

<i class="fas fa-comments" data-toggle="modal" data-target="#user_chat"></i>

<?=$informasi;?>