View file news.php

File size: 838B
<?php


$p = intval($_GET['p']);
echo'<div class="menu1">Новости каталога</div>';
switch ($mod) {
             //////INDEX//////
case 'index':
$all = mysql_num_rows(mysql_query("select * from `kat_news`"));
if($all==0){echo'Новостей пока-что нет :(';}else{
$k=$p+$data['sn'];
$q = mysql_query("select * from `kat_news` order by `time` desc limit $p , ".$data['sn']."");
while($f = mysql_fetch_array($q)){
echo'<small><b>'.(date("d.m.y H:i", $f[time])).'</b></small><br/>'.$f[news].'<br/>';
 }
if($p >= $data['sn']){
echo'<a href="?in=news&amp;p='.($p-$data['sn']).'">&laquo;назад </a>| '; }
if($all > $k){
echo'<a href="?in=news&amp;p='.$k.'">далее&raquo;</a>'; } 
 }
break;
              }
echo'<div class="menu3"><a href="?in=index">На главную</a></div>';
?>