in reply to Dont allow multiple registrations or automated script problem

It depends on how you stored the date and time. Is the field a MySQL DATETIME or TIMESTAMP? Or did you store epoch seconds in a INT field? If you have a choice, for a simple compare like this I would store epoch seconds and then you can test for 5 minutes easily.
my $sth = $dbh->prepare($your_sql_statement); my $row = $sth->fetchrow_hashref; print "not good\n" if ($row->{date} + (60*5) < time); $sth->finish;

If you'll be doing queries on the 'date' field (more than sorting). Then move over to the DATETIME or TIMESTAMP data type, where it will be good for the DB to know it's a time and can do SQL things with it.



grep
One dead unjugged rabbit fish later

Replies are listed 'Best First'.
Re^2: Dont allow multiple registrations or automated script problem
by Nik (Initiate) on Oct 21, 2006 at 14:57 UTC
    Actually i forgot to mention that my mysql date field its od type 'datetime' and not epoch or timestamp because as you said inddeed iam making other things as well with time except of comparing.
    I dont know wthough it the filed has to be datetime or timestamp, perhpas ouc an give an idea.
    Now that it is of a datetime type how would i check of the 5 mins delay?
      Follow smammy's solution. If a DB can do it internally in SQL, it will almost always be faster than trying to pull it out and working on it.


      grep
      One dead unjugged rabbit fish later