File size: 1.26Kb
<?php
$startan = $_GET['startan'];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=1;
$arr = mysql_query("SELECT * from `news`");
$qi = mysql_query("SELECT * from `news` ORDER by `id` DESC LIMIT $startan,$num_msgs_an;;;");
if (mysql_affected_rows()==0)
{
echo '<div class="menu">';
echo "Новостей ещё нет!";
echo '</div>';
exit();
}
else
{
while($row=mysql_fetch_array($qi))
{
$row = str_replace('<br/>', '<br/>', $row);
$row = str_replace('<b>', '<b>', $row);
$row = str_replace('</b>', '</b>', $row);
$row = str_replace('<u>', '<u>', $row);
$row = str_replace('</u>', '</u>', $row);
$row = str_replace('<i>', '<i>', $row);
$row = str_replace('</i>', '</i>', $row);
$row = str_replace('</i>', '</i>', $row);
echo '<div class="menu">';
echo '<img src="/img/news.png"><b>Последняя новость:</b><br/>';
echo ''.$row['text'].'<br/>';
echo '</div>';
}
}
//echo '<div class="menu">';
//$i = @mysql_num_rows($arr);
//if($startan!=0)
//echo '<a href="?startan='.($startan-$num_msgs_an).'">«</a> | ';
//if($i>$startan+$num_msgs_an)
//echo '<a href="?startan='.($startan+$num_msgs_an).'">»</a>';
//echo '</div>';
?>