include ("constructor.php"); include ("mysql.php"); if (empty($id)) {$id="all";} head(0); left_menu(1); mini_search(); $query="SELECT * FROM news"; $result = mysql_query($query) or die ("Невозможно выполнить запрос"); $i = mysql_num_rows($result); if ($i==0) { echo "
| Новости "; echo " Извините, новостей пока нет |
| Новости "; db_connect() or die("Cannot connect to server"); if ($id=="all") {$query="SELECT n_date, n_title, n_content FROM news ORDER BY n_date DESC LIMIT 8;";} elseif ($id=="month") { global $month, $year; echo ""; echo "Архив новостей за $month/$year "; $mindate=$year."-".$month."-01"; $maxdate=$year."-".$month."-31"; $query="SELECT n_date, n_title, n_content FROM news WHERE n_date>='$mindate' AND n_date<='$maxdate' ORDER BY n_date DESC"; } else { echo ""; $query="SELECT n_date, n_title, n_content FROM news WHERE id='$id' LIMIT 1;"; } $result = mysql_query($query) or die ("Невозможно выполнить запрос"); $i=0; while ($row = mysql_fetch_row($result)) { $i++; $new_date = explode("-",$row[0]); $OK_date = $new_date[2]."-".$new_date[1]."-".$new_date[0]; echo "$row[1] $row[2] $OK_date
"; } mysql_free_result ($result); echo " |
|