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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:11:43+00:00 2026-06-03T01:11:43+00:00

I need help with my script that is comparing current date with date that

  • 0

I need help with my script that is comparing current date with date that is entered in database, the thing that I wont to do is get alert message when the date from database pass the current date, and alert if the date from database is near the current date. The problem with my code comes when the month is different. Script works when comparing current day and day from database date, but when the month is different for example 02.05.2012 and 28.04.2012 the script is acting as if the 28.04.2012 is yet to come, he is not taking the month in consideration. I hope the question is clear. Here is the coding so far. Any ideas?

$vrjedi_do_osobna = $row['vrjedi_do_osobna'];

$current_date = date('d.m.Y');

$query = mysql_query("SELECT * from albums where vrjedi_do_osobna = '$current_date'
                                AND $id = 'userid'");




    $ime = $row['dosjename'];
    $prezime = $row['dosje_prezime'];
    $diff = abs(strtotime($current_date) - strtotime($vrjedi_do_osobna));

    $years = floor($diff / (365*60*60*24));
    $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
if($current_date < $vrjedi_do_osobna && $days < 10 && $days > 0 && $years < 1 && $months < 1)
    {
echo"<font face='gregorian' size='2'>";
   printf("&nbsp;<img src='slike_izgled/pj_sat.png' width='20' height='30'/>&nbsp;Osobna  iskaznica radnika $ime $prezime ističe za %d dana\n", $days);
echo"</font><br>";
    }
    if ($vrjedi_do_osobna <= $current_date)
                    {                                           
    echo "                            

&nbsp;<img src='slike_izgled/usklik.gif' width='25' height='25'>&nbsp;<font face='gregorian' size='2'>Osobna iskaznica radnika $ime $prezime-a je istekla!</font>&nbsp;&nbsp;&nbsp;&nbsp;<a href='viewdosje.php?album=".$row['ideo']."'>Pregled dosjea</a><br>

    "; 
// Do something

}
  • 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-03T01:11:45+00:00Added an answer on June 3, 2026 at 1:11 am

    You could store in a variable
    strtotime($current_date) - strtotime($vrjedi_do_osobna) and use it in the IFs by comparing it to 0 to see if the current date passed or not.

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

Sidebar

Related Questions

Need help writing a script downloads data from google insight using c# this is
I need some help from the shell-script gurus out there. I have a .txt
Need your help with my PHP/MYSQL array. I have a php script that selects
I need help with posting a value to a php script from a js
I need help with a script that when I check a checkbox it generates
I need it help with shell script, python script or anything that can do
I need help about that script. BOOL Checking(LPCSTR MacID) { char ClientMacs[18] = {
I need some help with a Bash script that will automatically add the git's
I need help, I created a script that hides / shows the menu and
I need help with my php script. I am working on a script that

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.