faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 13 people (54%) answered Yes
Recently 4 of 10 people (40%) answered Yes

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>
_______________________________________________________