Don't loop over empty list. Props Mark Jaquith. fixes #1827

git-svn-id: http://svn.automattic.com/wordpress/trunk@3032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-11-10 23:36:50 +00:00
parent f67be7f30f
commit d6800890df
1 changed files with 5 additions and 1 deletions

View File

@ -81,12 +81,14 @@ if ( is_month() ) {
</fieldset>
</form>
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC");
if ( count($arc_result) ) { ?>
<form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;">
<fieldset>
<legend><?php _e('Browse Month&hellip;') ?></legend>
<select name='m'>
<?php
$arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC");
foreach ($arc_result as $arc_row) {
$arc_year = $arc_row->yyear;
$arc_month = $arc_row->mmonth;
@ -106,6 +108,8 @@ if ( is_month() ) {
</fieldset>
</form>
<?php } ?>
<br style="clear:both;" />
<?php