Entry
How can I search a mysql database every 15 min using timestamp to see if there are new enterys
Sep 13th, 2000 12:10
Narendra Jain, Richard Kurth,
There might be many ways to solve this. I find this as a good way.
Notice that this is a combination of both php and Javascript. Please
note that time conversion is 15 min * 60 sec * 1000 m.sec = 900000.
Tested this script to load fine after 15 minutes.
Edit a file called test.html. Note that test.html is reloaded within
javascript.
_______________________________________________________
<html>
<head><title>PHP3 test page</title></head>
<body>
<? $l_date =Date(m);
# Insert your MySQL Query here to check new rows added, like
# expecting trans_table is a table in the database with at least
# one column being add_date.
$mydata = mysqlconnect($mydb,$myuser,$mypass);
if ( mysqlquery($mydata, "select * from trans_table where add_date >
$last_time"))
{
# Read next rows and process them
}
$last_time=Date(ydmhs);
?>
<script language="JavaScript">
function callurl()
{
window.location="./test.html"
}
window.setTimeout("callurl()",900000)
</script>
</body>
</html>
_______________________________________________________