Forum Moderators: open
$q = "SELECT attempts, CASE when lastlogin is NULL then 60 else TIMESTAMPDIFF(MINUTE, LastLogin, NOW()) end as Minutes FROM ".TBL_ATTEMPTS." WHERE ip = '$value'";
I think TIMESTAMPDIFF is calculating the difference between LastLogin (2006-09-12 18:21:31) and NOW() and converting to minutes.
Thanks