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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:13:48+00:00 2026-06-17T02:13:48+00:00

I have a comics website, http://www.hittingtreeswithsticks.com/ , which I add new comics to each

  • 0

I have a comics website, http://www.hittingtreeswithsticks.com/, which I add new comics to each week. I’d like a newly posted comic to remain highlighted until 3 days after the post date.

So, here’s before:

enter image description here

Here’s desired:

enter image description here

I’m considering the following logic:

date in the database is currently set to datetime: 0000-00-00 00:00:00

PHP: Get date of comic with a date = $row[‘date’] url parameter:

        echo '<ul>';
            $imageCounter = 0;
            while ($imageCounter < $imagesPerPage && ($row = $catResult->fetch_assoc())) {                  
                echo '<li>';
                    echo    '<span class="comics"><a href=".?action=viewimage&site='.$site. '&id=' . $row['id'] .'">
                            <img src="./scripts/thumber.php?date='. $row['date'] . '&img=.' . $thumbpath.$row['thumb'] . '&mw=220&mh=220"/></a> 
                            <br /><br /> ' . $row['description'] . '</span>';                               
                echo '</li>';
                $imageCounter++;
            }
    echo '</ul>';

Then set datetime to that date…

$datetime1 = date_create($_GET['date']);

Now, I’d like to somehow set datetime2 = (datetime1 + 3 days)…

Then compare…

if ($datetime1 < $datetime2) {
   set "comics" span class in CSS file to something else that would somehow highlight the newest post...
}
else {
   set "comics" span class in CSS file to default
}

Is there an easier way to accomplish what I’m trying to do?

EDIT——————————–

I’m trying this now to highlight the newest comic for a period of 3 days… unfortunately, I’m struggling to figure out how to highlight just the latest comic instead of all of the comics if the condition is met.

    //GET date  
        $desc = (isset($_GET['description']) ? ($_GET['description']) : null);  


    $row = $catResult->fetch_assoc();

    $current_date = new DateTime;
    echo "Current Date: " . $current_date->format('Y-m-d H:i:s');

    echo "<br />";

    $comic_date = new DateTime($row['date']);
    echo "Comic Date: " . $comic_date->format('Y-m-d H:i:s');

    $comic_date->modify('3 day');


    //DISPLAY IMAGES TO CORRECT PAGE FROM DATABASE  
    echo '<ul>';
        $imageCounter = 0;
        while (($row['date'] < $current_date) && ($imageCounter < $imagesPerPage) && ($row = $catResult->fetch_assoc())) {
                echo '<li>';                
                    echo    '<span class="comics"><a href=".?action=viewimage&site='.$site. '&id=' . $row['id'] .'">
                                <img src="./scripts/thumber.php?img=.' . $thumbpath.$row['thumb'] . '&mw=220&mh=220"/></a> 
                                <br /><br /> ' . $row['description'] . $row['date'] . '</span>';                                
                    $imageCounter++;
                echo '</li>';

            }   

        if ($row['date'] >= $current_date) {
                echo '<li>';                
                    echo    '<span class="newcomics"><a href=".?action=viewimage&site='.$site. '&id=' . $row['id'] .'">
                                <img src="./scripts/thumber.php?img=.' . $thumbpath.$row['thumb'] . '&mw=220&mh=220"/></a> 
                                <br /><br /> ' . $row['description'] . $row['date'] . '</span>';                                
                    $imageCounter++;
                echo '</li>';
            }
    echo '</ul>';   
  • 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-17T02:13:50+00:00Added an answer on June 17, 2026 at 2:13 am

    It is very easy to compare dates with DateTime.

    Example how to modify and compare dates:

    # PHP >= 5.4
    $row['date'] = '2013-01-03 16:15:14';
    $d = (new DateTime($row['date']))->modify('3 day');
    echo $d >= (new DateTime) ? 'NEW' : 'OLD';
    
    # PHP < 5.4
    $row['date'] = '2013-01-03 16:15:14';
    $n = new DateTime;
    $d = new DateTime($row['date']);
    $d->modify('3 day');
    echo $d >= $n ? 'NEW' : 'OLD';
    

    OR

    You can do this with sql statement:

    SELECT
        t.*,
        t.date >= DATE_SUB(NOW(), INTERVAL 3 DAY) AS is_new
    FROM 
        someTable AS t
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a comics website, http://www.hittingtreeswithsticks.com/ , where if you click on a comic
I have a comics website where I'm trying to implement a like/dislike system. Each
I'm building a website which will show comics. I'd like to store each image
Inspired by the XKCD geohashing comic (http://imgs.xkcd.com/comics/geohashing.png), I thought I'd have a go at
I have a comics website which loops through all images in a db and
I have a comics website where I'd like to allow users to vote once
I have a comics website, and I'd like to keep track of how many
I have a comics website which loops through all images in a db and
I have java related question... Website www.stationv3.com gets updated daily (most of the time
I have a comics website and would like to place text (database field description)

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.