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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:42:52+00:00 2026-05-26T11:42:52+00:00

i have a list with some days listed in a table, so , my

  • 0

i have a list with some days listed in a table, so , my database result come like this:

$day   = $res->fields['DAY'];

$month = $res->fields['MONTH'];

$year  = $res->fields['YEAR'];

and i put they all together to form a valid date

// put together the date
$date    = $res->fields['DAY']."/".$res->fields['MONTH']."/".$res->fields['YEAR'];     

// get the present day
$today   = date('d/m/Y');  // 28/10/2011

and i check:

if($date == $today){
   $backGroundTr = "red";
}

setting a <tr> background red.

the html is something like this:

<tr bgcolor="green">
   <td>31/10/2011</td>
</tr>
<tr bgcolor="green">
   <td>30/10/2011</td>
</tr>
<tr bgcolor="green">
   <td>29/10/2011</td>
</tr>
<tr bgcolor="red"> // this reciave the red bgcolor because is today
   <td>28/10/2011</td>
</tr>

now, what i’m trying to do is:

how can i set other color to the next 3 days ? as u can see in the example, i put the green color.

dont know if i was clear, any question, please, be my guest

  • 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-26T11:42:53+00:00Added an answer on May 26, 2026 at 11:42 am

    This should do the trick

    if($date == date('d/m/Y',strtotime('+1 day')) ||
        $date == date('d/m/Y',strtotime('+2 day')) ||
        $date == date('d/m/Y',strtotime('+3 day'))){
       $backGroundTr = "green";
    }
    

    or you can do something like that: (i assume you loop through your days) (this solution will not work as days are printed in the opposite order)

    $green=0;
    while ( ... ){
      ...
      if($date == $today){
        $backGroundTr = "red";
        $green=3;
      }
      if ($green>0)
      {
        $backGroundTr = "green";
        $green--;
      }
      ...
    }
    

    or you can do something like that:

    if(strtotime($date) > strtotime($today) && 
      strtotime($date) <= strtotime('+3 days',$today)
    {
      $backGroundTr = "green";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
I have a list that has some chapter numbers in string. When I sort
I have list of catalog paths and need to filter out some of them.
I am trying to output some Java objects as JSON, they have List properties
I have some std::list<char> list_type Now I have to supply contents of the list
If I have some R list mylist , you can append an item obj
I have a radio button list and some of the labels are quite long
I have an activity which shows some List entries. When I click on a
I have a simple list view with some check boxes in an alert dialog.
I have a overview page containing a list with some links from which multiple

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.