first commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include("core/main.php");
|
||||
if($_GET['checkNum']){ // if your load with ?checkNum=1 you just want to check if there is anything new (this is for optimization)
|
||||
$q = $db->query("select count(*) as nb from t_notification where status is null AND roles = ".$_SESSION['ROLES']);
|
||||
$r = $q->fetchAll()[0];
|
||||
echo $r['nb'];
|
||||
} else { // otherwhise you want to load the info about the newest notification to display and set the status to 1 so it wont be displayed again
|
||||
$q = $db->query("select * from t_notification where status is null AND roles = ".$_SESSION['ROLES']." order by id limit 1");
|
||||
$r = $q->fetchAll()[0];
|
||||
$db->query("update t_notification set status = 1 WHERE roles = ".$_SESSION['ROLES']."");
|
||||
echo $r['info'];
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user