Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8472313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:01:56+00:00 2026-06-10T17:01:56+00:00

I am trying to select users information from my database but I only want

  • 0

I am trying to select users information from my database but I only want to retrieve those who logged in the last 3 hours

I tried the following :

SELECT * FROM user  WHERE last > CURTIME(), INTERVAL 3 HOUR ORDER BY last DESC

But it is not working. I guess I put the INTERVAL function in the wrong place. but I tried many approaches and it is still not working.

How can you fix it? is there a better way than using the CURTIME() function ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:01:57+00:00Added an answer on June 10, 2026 at 5:01 pm

    You should be using NOW(), not CURTIME(), because CURTIME is just the time as a string, without the date. So if it’s 1am, someone who logged in yesterday at 11pm would not be included.

    SELECT * FROM USER
    WHERE last > DATE_SUB(NOW(), INTERVAL 3 HOUR)
    ORDER BY last DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get all the users information from the database and check
i am trying to select information from my mysql database with this statement after
I am trying to show information from database without reloading the page. I have
I'm trying to create a query that pulls information about sellers from my database,
I am trying get the data from my database but i am not getting
I'm trying to get the exact time and date when users select a button,
What I'm trying to do is, I'm asking user to select a value from
I currently am trying the following code: $sql = $db->query(select id,username,fullname from userss ORDER
I'm trying to update my database records, but no changes are made and no
I'm trying to create a SQL 2005 query to retrieve and combine records from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.