<?php
include $DOCUMENT_ROOT.'/wap/inc/db/config.php';
#########################################################
if (empty($page)) $page = 0;
if ($page < 0) $page = 0;
#########################################################
#########################################################
$count_query = 'select count(*) from news where 1 ;';
$total_mess = mysql_query ($count_query);
$total_count = mysql_fetch_array ($total_mess);
$count = $total_count ['count(*)'];
##########################################################
$query = 'select * from news where 1 ORDER BY `date` DESC LIMIT '.$page.', '.$max_mess.';';
$result = mysql_query($query);
if (!$result)
{
echo "Error! mysql_query".mysql_error();
exit;
}
echo "Всего Новостей: ".$count;
$row_date = htmlspecialchars(mysql_result($result, $i, "date"));
$row_category = htmlspecialchars(mysql_result($result, $i, "category"));
$row_name = htmlspecialchars(mysql_result($result, $i, "name"));
$row_news = htmlspecialchars(mysql_result($result, $i, "news"));
echo "<br/>:::<br/>";
echo $row_date;
echo '<br/> ';
echo $row_news;
echo '<br/> ';
echo 'Добавил:'.$row_name;
echo '<br/> ';
echo '<a href="/wap/mod/'.$row_category.'">Перейти</a>';
echo '<br/>:::<br/> ';
?>