multichild — 2013-08-09T08:34:01-04:00 — #1
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=''");
$a=mysql_query("select UniqueIdentifier, Name, Employerofperson, Location, DateOccured, HazardorNearMiss from hazzard WHERE HazardorNearMiss='' ORDER by UniqueIdentifier DESC");
fretburner — 2013-08-09T10:34:29-04:00 — #2
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.
multichild — 2013-08-09T10:58:02-04:00 — #3
Right I see yes, do a check on the records according to time.
multichild — 2013-08-09T12:47:07-04:00 — #4
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
fretburner — 2013-08-09T12:50:54-04:00 — #5
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.