in reply to users online script not accurate

Look through the documentation for your database, and let it do the date calculations for you. For example, in mysql, you would do:
DELETE FROM day_time WHERE time < DATE_SUB(NOW(), Interval 24 Hour)
This saves you from doing your own calculations, and makes sure you don't get bitten by the webserver and db server having clocks that are not in sync. (in the example I gave above, you're trusting the db to be the authoritive source)

Replies are listed 'Best First'.
Re^2: users online script not accurate
by tweetiepooh (Hermit) on Nov 08, 2005 at 11:17 UTC
    Agreed.

    In Oracle the current date/time is sysdate which is day based

    delete from table where dateattr < sysdate - 1;


    In systems like Oracle I'd probably use stored procedures and get Oracle to fire it off automatically. If there is other processing then you may need to call it via perl.

    Also don't forget to COMMIT if required.
    DBI can autocommit and some systems will also commit on disconnect but it's better practice to do it yourself. That way you have control.