Jump to content

navigation of months missing months with 30days


idlerob

Recommended Posts

Hi i have a navigation bar of months that is used to display news stories for that month, though today the months arent displaying properly which im guessing is because its a month with 31days so only the months with 31 days are showing

heres the code, it gets the news stories from the database and then creates the navigation

 

$page = "news";
if ( $_GET["s"] != "" ) {
$query = "SELECT headline, headline_image, headline_imagealt, full_story, news_date FROM news WHERE ID = ".$_GET["s"]." LIMIT 1;";
$story = mysql_fetch_object( mysql_query( $query ) );
} else {
if ( $_GET["m"] == "" ) {
	$limit = " LIMIT 5";
	$where = "";
} else {
    $limit = "";
	$start_date = $_GET["m"]."-01";
    $end_date = date( "Y-m-d", strtotime( $start_date." +1 month" ) ); 
	$where = " AND news_date >= '".$start_date."' AND news_date < '".$end_date."' ";
}
    // GET MAIN NEWS STORIES
    $query = "SELECT ID, headline, headline_image, headline_imagealt, full_story, news_date, more_info FROM news WHERE status_codeID = '2'".$where." ORDER BY news_date DESC".$limit.";";
$result = mysql_query( $query );
}

<div id="subnav">
		<p>
		<?php
		for ( $i=0; $i<6; $i++ ) {
                $_GET["m"] == date( "Y-m", strtotime( "-".$i." months" ) ) ? $selected = " curpage" : $selected = "";
			$i==0 ? $class=" class=\"first".$selected."\"" : $class=" class=\"".$selected."\"";
			print "<a href=\"whats_new.php?m=".date( "Y-m", strtotime( "-".$i." months" ) )."\"".$class.">".date( "F", strtotime( "-".$i." months" ) )."</a>";
		}
		?>
		</p>
        </div>

 

so today my navigation is missing out the months with 30days (november, september etc)

any help would be great thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.