Know when a new report is displayed in admin

I cant seem to think of a way of doing this, so that the manager viewing the admin area gets notified by an alert when a new report has been added.

When the manager logs in there are already reports there, then when the page refreshes if a new report comes through how do you know that to create an alert.

I understand that there might be a new ID in the database, but how do you grab the ID of the current newest report, and then compare it on refresh and then when a new report comes in when the page refreshes how do you compare the two to know that there a more current one there.

These are the two scripts looking for the new reports@


<? $a=mysql_query("select count(UniqueIdentifier) as total1 from hazzard where HazardorNearMiss=''");
$data=mysql_fetch_assoc($a);
//echo $data['total1'];
?>


<?
$a=mysql_query("select UniqueIdentifier, Name, Employerofperson, Location, DateOccured, HazardorNearMiss from hazzard WHERE HazardorNearMiss='' ORDER by UniqueIdentifier DESC");
while($x=mysql_fetch_assoc($a)){
?>

If your records have a ‘date created’ timestamp or datetime field, you can do a simple calc in your script to mark all those created in the last 50 mins, and then display them in some way that they stand out from the rest.

Right I see yes, do a check on the records according to time.

Thanks fretburner.

Im pretty sure this is correct below, but I dont seem to be able to view what I have selected in the database.


$fetch = mysql_query("SELECT DateOccured FROM hazzard LIMIT 1 ")or
die(mysql_error()); ?>

<?=$fetch['DateOccured']?>

The mysql_query function only returns a resource - you have to pass that resource to another function such as mysql_fetch_assoc in order to get the data from it.