Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
require("config.php");
$page = (int)$_GET['page'];
if ($page < 1)
{
exit;
}
$result2 = mysql_query("SELECT * FROM news") or die(mysql_error());
$limit = "5";
$start = ($page - 1)*$limit;
$num = mysql_num_rows($result2);
$pages = ceil($num / $limit);
$result = mysql_query("SELECT * FROM news ORDER BY id ASC LIMIT $start, $limit") or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
echo "
<table width='500px' border='1'>
<tr>
<td>Име: $row[name]</td>
</tr>
<tr>
<td>$row[news]</td>
</tr>
</table>
<br>
";
}
for($i=1;$i<=$pages;$i++)
{
echo "<a href='".basename(__FILE__)."?page=$i'>$i</a>";
}
?>
<?php header( 'Content-Type:text/html; charset=UTF-8' );
$page = (int)$_GET['page'];
if($page == 0 || $page == NULL || $page < 0)
{
$page = 1;
}
$pp = 6; //kolko rezultata na stranica
$start = ($page*$pp) - $pp;
include ('./files/config.php');
$query = mysql_query("SELECT * FROM `newss` "); //pishesh tablicata
$broi = mysql_num_rows($query);
$total = ceil($broi/$pp);
$result = mysql_query("SELECT * FROM `newss` ORDER BY `id` DESC LIMIT $start,$pp "); //pishesh tablicata pak
while ($row = mysql_fetch_array($result))
{
$promenliva1=row['pole'];
echo "$promenliva1"
}
echo "<div id = 'STR' style = 'width:572px; color:#fff;'>"; // tuka mojesh da si promenish stilovete (css) drugoto ne go barash
if ($page > 1) {
$prev = ($page - 1);
echo "<a style='text-decoration:none;' href=\"?page=$prev\"><font face=\"Trebuchet MS\" style=' margin-right:7px; margin-top:-1px; color:#fff;'>Предишна </font></a> ";
}
else echo "<font face=\"Trebuchet MS\" style=' margin-right:7px; margin-top:-1px; text-decoration:none;'>Предишна </font> ";
if (!$page or ($page > $total)) {
$page="1";
}
if ($total < 10) {
for($i=1 ; $i<=$total ; $i++) {
if ( ($page)==$i ) {
echo "<b style='background: url(images/STR_ACTIVE.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px; '>$i</b> ";
}
else {
echo "<a style=' background: url(images/STR.jpg) no-repeat; color:#fff; padding-left:8px; padding-right:8px; padding-bottom:1px; ' href=\"?page=".$i."\"><b>".$i."</b></a> ";
}
}
}
else {
for($i=1 ; $i<=3 ; $i++) {
if ( ($page)==$i ) {
echo "<b style='background: url(images/STR_ACTIVE.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;'>$i</b> ";
}
else {
echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;' href=\"?page=".$i."\">".$i."</a> ";
}
}
if ($page <= 3) {
if ($page == 3) echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;' href=\"?page=4\">4</a> ";
echo "... ";
for ($i=$total-2; $i<=$total; $i++)
echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;' href=\"?page=".$i."\">".$i."</a> ";
}
if ($page == 5) $parva.= "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;' href=\"?page=4\">4</a> ";
if ( ($page == 4) or ($page == 5) ) {
for ($i=$page; $i<=$page+1; $i++) {
if ($page == $i) echo "<b style='background: url(images/STR_ACTIVE.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;'>$i</b> ";
else echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;' href=\"?page=".$i."\">".$i."</a> ";
}
echo "... ";
for ($i=$total-2; $i<=$total; $i++)
echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;' href=\"?page=".$i."\">".$i."</a> ";
}
if ( ($page > 5) and ($page < ($total - 4)) ) {
echo "... ";
for ($i=$page-1; $i<=$page+1; $i++) {
if ($page == $i) echo "<b style='background: url(images/STR_ACTIVE.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;'>$i</b> ";
else echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px; ' href=\"?page=".$i."\">".$i."</a> ";
}
echo "... ";
for ($i=$total-2; $i<=$total; $i++)
echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px; ' href=\"?page=".$i."\">".$i."</a> ";
}
if ( $page > ($total - 5) ) {
echo "... ";
for ($i=$total-5; $i<=$total; $i++) {
if ($page == $i) echo "<b style='background: url(images/STR_ACTIVE.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px;'>$i</b> ";
else echo "<a style=' background: url(images/STR.jpg) no-repeat; padding-left:8px; padding-right:8px; padding-bottom:1px; ' href=\"?page=".$i."\">".$i."</a> ";
}
}
}
if ($page < $total) {
$next = ($page + 1);
echo "<a style='text-decoration:none;' href=\"?page=$next\"><font face=\"Trebuchet MS\" style=' margin-left:7px; margin-top:-1px; color:#fff;'>Следваща </font></a> ";
}
else echo "<font face=\"Trebuchet MS\" style=' margin-left:7px; margin-top:-1px;'>Следваща </font>";
echo"</div>";
?>