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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:00:44+00:00 2026-06-15T15:00:44+00:00

Hi i have a site with users displayed on the front page. When users

  • 0

Hi i have a site with users displayed on the front page. When users sign up to the site they sign up with their date of birth. This is stored in my database.

I have pulled the users from the database and have their location and name displaying.

I am also trying to add their age which is calculated from their date of birth. But at the moment it won’t work, the users age isn’t being displayed.

Can anyone help me find where i’m going wrong?

Code:

 <?php
 $dob = $platinum['dob'];

function age_from_dob($dob) {

    list($y,$m,$d) = explode('-', $dob);

    if (($m = (date('m') - $m)) < 0) {
        $y++;
    } elseif ($m == 0 && date('d') - $d < 0) {
        $y++;
    }

    return date('Y') - $y;

}

$dob = age_from_dob($dob);

?>

<?

        $platinum_set = get_platinum_users();
        while ($platinum = mysql_fetch_array($platinum_set)) {
            echo"
            <div class=\"platinumcase\">
            <a href=\"profile.php?id={$platinum['id']}\"><img width=80px height= 80px src=\"data/photos/{$platinum['id']}/_default.jpg\" class=\"boxgrid\"/></a><h58> {$platinum['first_name']} {$platinum['last_name']}</h58><br/><br/><h52>{$platinum['$dob']}<br/><br/>{$platinum['location']}</h52>

            </div>";
        }
    ?>
  • 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-15T15:00:45+00:00Added an answer on June 15, 2026 at 3:00 pm
    function age_from_dob($dob) {
        return DateTime::createFromFormat('Y-m-d',$dob, $tz)->diff(new DateTime('now', $tz))->y;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a members site where users are given up to 7 web page
I have a section of my site where users can add addresses to their
I have created a page on my site where users can post directly to
I have a site i'm working on http://trueproperty.org/ and on the front page i
I've got a site where users submit submissions and they all get displayed on
I am making a site which allows users to sign up and record their
I have a site where users can log in and check on outstanding support
Let's say I have a site where Users can add Entries through admin panel.
I have a site where some users will be registered by our staff, and
I currently have a web site where users can select a custom theme. After

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.