View Single Post
Old 03-23-2009, 07:51 PM   #7 (permalink)
Andrial12
The Wanderer
 
Join Date: Feb 2008
Location: Blackpool, England
Posts: 16
Thanks: 2
Andrial12 is on a distinguished road
Default

Yes that would be correct however you may be better using the MINUTE keyword if you need to use fractions of an hour as afaik the variable has to be an integer for example:

PHP Code:
$sql "
    DELETE FROM `users` 
    WHERE 
        `signupdate` < DATE_SUB( NOW(), INTERVAL {" 
$timeframe "} MINUTE ) 
    AND `lastlogin` = `signupdate`;
"

I've not got a database to hand at the moment to test it on, however I would have thought it was faster on larger tables as your passing less data between your database server and your web server. Of course if your expecting a large number of these false sign ups I would suggest putting an index on the date column too.

In truth however, selecting everything from a table is seldom a good idea. I personally would use MySQL for anything like this as thats what it was designed to do.

Also in your case I would definatly recommend using MySQL for this job, as you intend to cron the script for every 5-30 mins, this way your not passing your whole users table to your webserver every few minutes for it not to alter any records.

Hope that helps
Andrial12 is offline  
Reply With Quote