List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 28 2006 3:49am
Subject:Re: selecting all records inserted last 1 minutes?
View as plain text  
At 22:29 -0500 4/27/06, Afan Pasalic wrote:
>No, not exactly. More as "there is a solution"...
>What would be the best way to do?
>
>-afan

What's wrong with WHERE last_access >= NOW() - INTERVAL 1 HOUR ?

You don't want CURTIME(), I think, because that has only time, not the
date.


>
>Paul DuBois wrote:
>>At 20:52 +0200 4/27/06, afan@stripped wrote:
>>>Hi,
>>>I was trying to list all registeed users they are "online" last 15 minutes.
>>>I can do it by using timestamp:
>>>
>>><?php
>>>$current_time = time();
>>>$start_time = ($current_time - 15*60);
>>>
>>>SELECT * FROM members WHERE last_access >= '$start_time'
>>>?>
>>>
>>>But, I know there is something like:
>>>
>>>SELECT * FROM members WHERE last_access BETWEEN(CURTIME(), INTERVAL 15 MIN)
>>>?!?
>>>
>>>Thanks for any help.
>>
>>If you mean "what is the syntax of BETWEEN?," it's in this section
>>of the manual:
>>
>>http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html

-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Thread
selecting all records inserted last 1 minutes?afan27 Apr
  • Re: selecting all records inserted last 1 minutes?Paul DuBois27 Apr
    • Re: selecting all records inserted last 1 minutes?Afan Pasalic28 Apr
      • Re: selecting all records inserted last 1 minutes?Paul DuBois28 Apr
        • Re: selecting all records inserted last 1 minutes?afan28 Apr