Hello folks,
BACKGROUND TO PROBLEM
I am in the process of moving to PHP from ASP, and I will be bringing a team of open source developers with me. In order to learn PHP, I decided to develop an application to manage (physical) conferences based on one we did in ASP (http://idlelo.uwc.ac.za). Now I am up against something that was easy in ASP/M$SQL, but seems to be very difficult in PHP.
THE PROBLEM TO SOLVE
I have a table, tbl_loggedinusers that enables users to communicate with one another and maintain state. Any activity on the site updates the table with the time that any given page was loaded. I need to purge the table regularly by checking if the timelastactive in any records is more than 20 minutes ago, and then deleting the record. Note: I use PEAR DB for database abstraction, mySQL as the database.
Conceptually, what I want to do is:
$sql="DELETE FROM tbl_loggedinusers WHERE DATEDIFF(whenlastactive, '".$myDate."')<1200";
THE QUESTION
Is there a way to achieve this easily? I have searched on this and other boards, documentation, etc and all 11 books that I bought and I am totally stuck. It just seems so simple.
Thanks for your time and patience,
Derek