Changeset 451 for branches/beta/inc


Ignore:
Timestamp:
Mar 1, 2009, 2:13:07 PM (16 years ago)
Author:
amun
Message:

Stránkování novinek...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/beta/inc/html.php

    r445 r451  
    223223        {
    224224        // TODO !!
    225           while ($row = $sql -> fetch_array())
     225               
     226  while ($row = $sql -> fetch_array())
    226227          {
    227228            switch ($row["category"])
     
    267268            ";
    268269          }
     270                 
     271mysql_connect($db_server, $db_user, $db_pass);
     272  mysql_select_db($db_webu);
     273  $limit = 5;
     274$pocet = mysql_result(mysql_query(" SELECT FOUND_ROWS()"), 0);
     275if ($_GET["offset"]) {
     276    echo "<a href='$_SERVER[PHP_SELF]" . ($_GET["offset"] != $limit ? "?offset=" . ($_GET["offset"] - $limit) : "") . "'>zpět</a>\n";
     277}
     278if ($pocet > $_GET["offset"] + $limit) {
     279    echo "<a href='$_SERVER[PHP_SELF]?offset=" . ($_GET["offset"] + $limit) . "'>vpřed</a>\n";
     280}
     281
     282$result = mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM tabulka ORDER BY datum DESC, id DESC LIMIT $limit OFFSET " . ($limit * $_GET["strana"]));
     283$pocet = mysql_result(mysql_query(" SELECT FOUND_ROWS()"), 0);
     284if ($_GET["strana"]) {
     285    echo "<a href='$_SERVER[PHP_SELF]" . ($_GET["strana"] != 1 ? "?strana=" . ($_GET["strana"] - 1) : "") . "'>zpět</a>\n";
     286}
     287if ($pocet > $limit * ($_GET["strana"] + 1)) {
     288    echo "<a href='$_SERVER[PHP_SELF]?strana=" . ($_GET["strana"] + 1) . "'>vpřed</a>\n";
     289}
     290       
    269291        }
    270292        else
Note: See TracChangeset for help on using the changeset viewer.