I have create a notification system using php and jquery
I have a page name select-task.php
this page contain this code
$sql = mysqli_query($conn,"SELECT
count(db_taskid) as sum from tbl_task where db_read='0' and (db_userid='$uid' or db_transfered='$uid')")or die(mysqli_error($conn));
$row = mysqli_fetch_array($sql);
$count = mysqli_num_rows($sql);
echo $taskCount=$row['sum'];
$conn->close();
jquery code:
$(document).ready(function(){
$("#task").load("select-task.php");
setInterval(function(){
$("#task").load('select-task.php')
}, 20000);
});
This code work fine and i receive the notification but i try to get the variable $taskCount from select-task.php page to do a verification if this variable equal to zero don't add class not if not add the class not
this is the html code
<li class="dropdown dropdown dropdown-extended dropdown-notification dropdown-dark " id="header_notification_bar">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" data-hover="dropdown" data-close-others="true">Task <i class="icon-bell"></i><span class="badge badge-success" id="span"><div id="task"></div></span>
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="add-tasks.php" target="_blank">Add Task</a>
<li><a href="all-tasks.php" target="_blank">All Task</a></li>
</ul>
I've try to do like this
if($taskCount==0){echo'<span class="badge badge-success">';}
else{echo'<span class="badge badge-success not">';}
But i receive an error that this an unknown variable.
How can i get this error to do this verification ??!!!