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

  • Home
  • SEARCH
  • 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 6024561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:10:25+00:00 2026-05-23T04:10:25+00:00

I want to build a query like SELECT username from users WHERE login_attempts >

  • 0

I want to build a query like

SELECT username from users
 WHERE login_attempts > 3 AND last_attempt_time < 24 (hours).

I have 2 questions to build the above query.

  1. I’m storing the date in last_attempt_time in DATETIME format (2011-06-16 10:29:23)
    Can I directly select some row which has time difference less than 24 hours from now? (OR do I have to select a row, and then check with for example PHP the time difference? )

  2. How can I write this query using CodeIgniter Active Record? (Do I need to use get_where?) I could not find any related example in their documentation.

Thanks.

  • 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-23T04:10:26+00:00Added an answer on May 23, 2026 at 4:10 am

    Try this:

    $this->db->select('username');
    $this->db->from('users');
    $this->db->where('login_attempts >', 3);
    $this->db->where('last_attempt_time <', date('Y-m-d H:i:s', strtotime('-24 hours')));
    
    $query = $this->db->get();
    

    You can find the complete documentation here: http://codeigniter.com/user_guide/database/active_record.html#select.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine I have the following SQL query: SELECT id,name FROM user WHERE id IN
I want to build a rails query like the following. And would like to
I want to build a bot that asks someone a few simple questions and
I want to build something like a network scanner, so that I see in
I have a data model like the following: username | product1 | product2 -------------------------------
I want to build a single select stored procedure for SQL 2005 that is
Here is the pseudo-code for my inline query in my code: select columnOne from
I want to build GQL query to get an object using its numeric id.
If all tables I want to delete from have the column gamer_id can i
I have built a NamedQuery that looks like this: @NamedQuery(name = EventLog.viewDatesInclude, query =

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.