$mdescr[1] = 'Январь' ;
$mdescr[2] = 'Февраль' ;
$mdescr[3] = 'Март' ;
$mdescr[4] = 'Апрель' ;
$mdescr[5] = 'Май' ;
$mdescr[6] = 'Июнь' ;
$mdescr[7] = 'Июль' ;
$mdescr[8] = 'Август' ;
$mdescr[9] = 'Сентябрь' ;
$mdescr[10] = 'Октябрь' ;
$mdescr[11] = 'Ноябрь' ;
$mdescr[12] = 'Декабрь' ;
$db = mysql_connect ( "localhost", "eco", "Avers" ) ;
mysql_select_db ( "ecolife" ) ;
$sth = "SELECT year(ndate) AS YE, month(ndate) AS MO FROM ".
"eco_news where ndate>\"2001-09-01\" GROUP BY YE,MO ORDER BY YE DESC,MO DESC" ;
$sth = mysql_query ( $sth ) ;
print ( "" ) ;
while ( $row = mysql_fetch_row( $sth ) )
{
printf( "[%s] %s | ",
$row[0], $mdescr[$row[1]] ) ;
$stm = sprintf ( 'SELECT id,ndate,header FROM eco_news '.
'WHERE year(ndate)="%s" AND month(ndate)="%s"'.
' ORDER BY ndate DESC', $row[0], $row[1] ) ;
$sth1 = mysql_query ( $stm ) ;
// print '' ;
while ( $row1 = mysql_fetch_row( $sth1 ) )
{
print '' ;
$url = sprintf (
'%s', $row1[0],
$row1[2] ) ;
printf('[%s] | %s | ',
$row1[1], $url ) ;
print ' ' ;
}
// print ' ' ;
}
print ( " " ) ;
?>
|