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 3213416
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:56:31+00:00 2026-05-17T14:56:31+00:00

How can I filter out online users, if I have a column lastaccess that

  • 0

How can I filter out online users, if I have a column “lastaccess” that have a unix time() stamp. Then I usually have this function:

function showStatus($userid) {
    $timeoutIdle = 80;
    $timeoutOffline = 150;
    $row = mysql_query("select last_access from users where id='$userid'");
    $read = mysql_fetch_array($row);
    $last_access = $read["last_access"];
    $thetime = time();
    if ($thetime - $last_access > $timeoutOffline) {
        echo "";
    }
    else if ($thetime - $last_access > $timeoutIdle) {
        echo "<span class='statusIdle'>Idle</span>";
    } else {
        echo "<span class='statusOnline'>Online</span>";
    }
}

How do I make a query, where it displays if you’re online?

  • 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-05-17T14:56:32+00:00Added an answer on May 17, 2026 at 2:56 pm
    $sql = "SELECT
              CASE
                WHEN last_access < UNIX_TIMESTAMP()-150 THEN 'offline'
                WHEN last_access < UNIX_TIMESTAMP()-80 THEN 'idle'
                ELSE 'online'
              END AS online_status
            FROM users
            WHERE id = $userid";
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that can filter a datagridview based on date using a
I'm trying to make a cgridview that can filter data from relations table. This
Is there any way i can filter out lines containing a certain word that
My project idea is to create filters so that I can filter out what
I have a set of data with over 1000 entries. I can filter these
Ok, I have this array of a users friends, and I'm just wondering how
Just want to know how I can filter out a result using mysql if
This is weird, and I can't find anything like it online. I am rendering
I am trying to figure out how I can filter out key and value
how can i filter out some entities by a list of them, i tried

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.