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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:16:52+00:00 2026-06-05T00:16:52+00:00

i have a function which gets all the newly registered users, and displays it

  • 0

i have a function which gets all the newly registered users, and displays it depending on the filter given whether it is newly registered by month or by year.

on this example i am using year, i have this sql

Select date_registered from users where date_registered > '2011-12-31 12:59:59' AND date_registered < '2013-01-01 12:00:00'

so this will result in all date_registered registered for the year 2012

the question is how to be more dynamic that i may apply a filter for example
where date_registered > $dynamic_date and date_registered < $dynamic_date

or any good advise how to achieve this better.

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-06-05T00:16:54+00:00Added an answer on June 5, 2026 at 12:16 am

    If it’s a small data set, I would go the pure SQL route that Tikkes’ answer shows; however, for index purposes, calculating the bounds may be better.

    mktime and date can be used for this:

    $lowerBound = date('Y-m-d H:i:s', mktime(0, 0, -1, 1, 1, date('Y')); //1 second before 00:00:00 1 Dec <current year>
    $upperBound = date('Y-m-d H:i:s', mktime(0, 0, -1, 1, 1, date('Y') + 1); //1 second before 00:00:00 1 Dec <current year + 1>
    

    So then you just put them in a query:

    $sql = " ... WHERE d > '$lowerBound' AND d < '$upperBound'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function which gets object of some type as it parameter. I
I have the following JavaScript code which gets all of the id's of the
I have 5 functions which gets called 10000+ times (on an average). All of
I have to create a function which gets 5 parameters representing information about the
I have the following function which takes url path and gets the reader. As
I have a file called function.js which has all my jQuery for my aplication
Alright, I have jQUery function which adds class to a div#float once div#floatLunch gets
i have a js function which gets html to create new employee from controller,
I have a static method 'findAll' on a model which basically gets all rows
hi i have function which is called by tinker listbox so i cannot return

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.