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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:52:16+00:00 2026-06-08T01:52:16+00:00

I want to add a filter to my MySQL query based on users birthday.

  • 0

I want to add a filter to my MySQL query based on users birthday.

Providing:

$cur_year = 2012
$cur_month = 07
$cur_day = 18

How do I do the difference $cur_year - $minAge and then display -07-19 (month and day)

I’m trying this:

`Birthday` < $cur_year - $minAge'-$cur_month-$cur_day'
  • 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-08T01:52:17+00:00Added an answer on June 8, 2026 at 1:52 am

    I’m reasonably certain you are trying to do something like this:

    $minAge = 18;
    
    $query = "
      SELECT
        `somecol`, `someothercol`,
        IF(DATE_ADD(`Birthday`, INTERVAL ".((int) $minAge)." YEAR) < NOW(), 1, 0) AS `isOldEnough`
      FROM `tablename`
      WHERE `somecol` = 'someval'
    ";
    

    In each returned row, the isOldEnough key in the result will contain 1 if the user is 18 years old, or 0 if they aren’t.

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

Sidebar

Related Questions

I want to add a new filter to the Project Explorer, to hide from
I want to add a custom model method to the admin filter, however it
Ok so I’m using the quicksand jquery filter. now I want to add a
Hey, I want to add a button(link), that when clicked will filter the pagination
How to add filter to the fileupload control in asp.net? I want a filter
How to add filter to the fileupload control in asp.net? I want a filter
Background I want to add a model manager function that filters a queryset based
I want to add a filter textbox to an application so that when a
So I want to add the data filter to the UL if there are
I have a column in a datatable and I want to add a filter

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.