idlerob Posted January 31, 2008 Share Posted January 31, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/88716-navigation-of-months-missing-months-with-30days/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.