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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:28:12+00:00 2026-06-16T19:28:12+00:00

Would like to ask how to add an if statement into the following code.

  • 0

Would like to ask how to add an if statement into the following code.

What it presently does is list all of the news articles from the database under a title of their respective months/years and groups the articles under this:
i.e.
May 2012 – News A, News B
June 2012 – News C
July 2012 – News D

We are having an issue with stories prior to 1970, due to the unix date system being used.
I don’t wish to change the system that we presently use due to it “working”, however, if a fix could be found for this (i’ve tried minus figures….it doesnt work), OR if an if statement could be added into this code below, that stops articles from being displayed/groups being created for articles pre-1970 then this would be good 🙂

<h3>Archive</h3>
<? $news=$session->getNews("","","",1);?>
<? while($article=mysql_fetch_array($news)){?>
<? 
$date = $article['thedate'];
$year = date('Y', $date);
$month = date('F', $date);
?>
<h4><?=$month." - ".$year;?></h4>
<nav class="small">
<? $innernews=$session->getNews("",$month,$year);?>
<? while($innerarticle=mysql_fetch_array($innernews)){?>
<a href="/news/<?=$innerarticle['ftitle']?>" <? if($title==$innerarticle['ftitle']){?> class="active"<? }?>><?=$innerarticle['title']?></a>
<? }?>
</nav>
<? }?>
<h4>Pre-1970</h4>
<nav class="small">
<a href="#">See More - Currently Unavailable</a>
</nav>
</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-16T19:28:13+00:00Added an answer on June 16, 2026 at 7:28 pm

    As “crude” as Matthew Harrington requested:

    <h3>Archive</h3>
    <? $news=$session->getNews("","","",1);?>
    <? while($article=mysql_fetch_array($news)){?>
    <? 
    $date = $article['thedate'];
    $year = date('Y', $date);
    $month = date('F', $date);
    if ($year<1970) continue;
    ?>
    <h4><?=$month." - ".$year;?></h4>
    <nav class="small">
    <? $innernews=$session->getNews("",$month,$year);?>
    <? while($innerarticle=mysql_fetch_array($innernews)){?>
    <a href="/news/<?=$innerarticle['ftitle']?>" <? if($title==$innerarticle['ftitle']){?> class="active"<? }?>><?=$innerarticle['title']?></a>
    <? }?>
    </nav>
    <? }?>
    <h4>Pre-1970</h4>
    <nav class="small">
    <a href="#">See More - Currently Unavailable</a>
    </nav>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to ask if it is possible to add an element into
I would like to Add a if statement to surround some code. I need
I would like to ask how to add HSQLDB library hsqldb.jar in Maven? I
I would like to ask you how to add several listeners to the several
I would like to ask you if is possible to add a shadow to
I would like to ask your guidance on how to authenticate using email add/
I would like ask if there's a way to download an android layout from
I would like to ask how to add data with links after the description
I would like to ask about how can I add different overlays to my
I would like to ask you how can I insert JPanel into JOptionPane and

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.