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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.