<?



//if (mysql_result(mysql_query("SELECT COUNT(*) FROM `news` LIMIT 1",$db), 0)==0){header("Location: /index.php?".SID);exit;}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `news`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 1");
echo "<table class='post'>\n";
if ($k_post==0)
{
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "Нет новостей\n";
echo "  </td>\n";
echo "   </tr>\n";

}
while ($post = mysql_fetch_assoc($q))
{
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "$post[title]\n";
echo "(".vremja($post['time']).")\n";
echo "  </td>\n";
echo "   </tr>\n";
echo "   <tr>\n";
echo "  <td class='page_foto'>\n";
echo output_text($post['msg']) . "<br />\n";
if ($post['link']!=NULL)echo "<a href='".htmlentities($post['link'], ENT_QUOTES, 'UTF-8')."'>Подробности</a><br />\n";
echo "<a href='news/komm.php?id=$post[id]'>Мнения</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_news` = '$post[id]'"),0).")\n";
echo "  </td>\n";
echo "   </tr>\n";
}
echo "</table>\n";


?>