can someone help me how to get rid the counts or number on notification after I read or open it... I hope you understand, sorry if its vague and to my bad English tho. Just here my sample codes..
/index.php
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function addmsg(type, msg){
$('#notification_count').html(msg);
}
function waitForMsg(){
$.ajax({
type: "GET",
url: "select.php",
async: true,
cache: false,
timeout:50000,
success: function(data){
addmsg("new", data);
setTimeout(
waitForMsg,
1000
);
},
error: function(XMLHttpRequest, textStatus, errorThrown){
addmsg("error", textStatus + " (" + errorThrown + ")");
setTimeout(
waitForMsg,
15000);
}
});
};
$(document).ready(function(){
waitForMsg();
});
</script>
</head>
<body>
<span id='notification_count'></span>
<a href="notificationview.php" id="notificationLink" onclick = "return getNotification()">Notifications</a>
<div id="HTMLnoti" style="textalign:center"></div>
<br>
<p style="font-weight: bold; font-size: 20px; font-family: Tahoma;">Admin panel</p>
<form action="index.php" method="post">
<input type="text" required name="notification" autofocus="on" autocomplete="off">
<br>
<br>
<input type="text" name="status" value="unread" style="display: none;">
<input type="submit" name="btnsub" value="Submit">
</form>
and then my /select.php where why my notification counts..
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "messageTest";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * from messageTest where status = 'unread'";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$count = $result->num_rows;
echo $count;
$conn->close();
?>
please! all I want is get rid of the counts on the notification after the user open or read it. Thanks!
my database name = "messageTest" my database table = "messagetest" inside my table =
id notification status