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

...

File:
1 edited

Legend:

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

    r454 r455  
    221221  mysql_select_db($db_webu);
    222222  $limit = 5;
    223      
    224         $sql = mysql_query("SELECT * FROM articles $where ORDER BY date DESC, id DESC LIMIT $limit OFFSET " . intval($_GET["offset"]);
    225                 $pocet = mysql_query(mysql_num_rows("SELECT date FROM articles $where ");
    226         if ($pocet > 0)
    227         {
    228         // TODO !!
    229                
    230   while ($row = mysql_fetch_array($sql))
    231           {
    232             switch ($row["category"])
     223     mysql_query("SET NAMES 'utf8'");
     224$result = mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM articles $where ORDER BY date DESC LIMIT $limit OFFSET " . intval($_GET["offset"]));
     225$pocet = mysql_query(mysql_num_rows("SELECT date FROM `articles` $where ");
     226if ($pocet > 0)
     227        {
     228while($row = mysql_fetch_array($result)){
     229 switch ($row["category"])
    233230            {
    234231              case 1:
     
    271268            <br />
    272269            ";
    273           }
    274                  
     270}
     271$pocet = mysql_result(mysql_query(" SELECT FOUND_ROWS()"), 0);
     272if ($_GET["offset"]) {
     273    echo "<a href='$_SERVER[PHP_SELF]" . ($_GET["offset"] != $limit ? "?offset=" . ($_GET["offset"] - $limit) : "") . "'>zpět</a>\n";
     274}
     275if ($pocet > $_GET["offset"] + $limit) {
     276    echo "<a href='$_SERVER[PHP_SELF]?offset=" . ($_GET["offset"] + $limit) . "'>vpřed</a>\n";
     277}
    275278
    276279
    277 if ($_GET["offset"]) {
    278     echo "<a href='$_SERVER[PHP_SELF]" . ($_GET["offset"] != $limit ? "?offset=" . ($_GET["offset"] - $limit) : "") . "'>zpět</a>\n";
    279 }
    280 if ($pocet > $_GET["offset"] + $limit) {
    281     echo "<a href='$_SERVER[PHP_SELF]?offset=" . ($_GET["offset"] + $limit) . "'>vpřed</a>\n";
    282 }
    283 
    284 $result = mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM articles ".$where." ORDER BY date DESC, id DESC LIMIT $limit OFFSET " . ($limit * $_GET["strana"]));
    285 
     280$result = mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM articles $where ORDER BY date DESC $limit OFFSET " . ($limit * $_GET["strana"]));
     281$pocet = mysql_result(mysql_query(" SELECT FOUND_ROWS()"), 0);
    286282if ($_GET["strana"]) {
    287283    echo "<a href='$_SERVER[PHP_SELF]" . ($_GET["strana"] != 1 ? "?strana=" . ($_GET["strana"] - 1) : "") . "'>zpět</a>\n";
     
    290286    echo "<a href='$_SERVER[PHP_SELF]?strana=" . ($_GET["strana"] + 1) . "'>vpřed</a>\n";
    291287}
     288 
    292289       
    293290        }
Note: See TracChangeset for help on using the changeset viewer.