Forum Moderators: open

Message Too Old, No Replies

Convert MySQL 5 Statement to 4

TIMESTAMPDIFF problem

         

boxfan

1:28 am on Sep 13, 2006 (gmt 0)

10+ Year Member



I'm hoping someone can rewrite this MySQL statement for me. I'm not running MySQL 5 yet.

$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