- Timestamp:
- Mar 1, 2009, 2:46:35 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/beta/inc/html.php
r454 r455 221 221 mysql_select_db($db_webu); 222 222 $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 "); 226 if ($pocet > 0) 227 { 228 while($row = mysql_fetch_array($result)){ 229 switch ($row["category"]) 233 230 { 234 231 case 1: … … 271 268 <br /> 272 269 "; 273 } 274 270 } 271 $pocet = mysql_result(mysql_query(" SELECT FOUND_ROWS()"), 0); 272 if ($_GET["offset"]) { 273 echo "<a href='$_SERVER[PHP_SELF]" . ($_GET["offset"] != $limit ? "?offset=" . ($_GET["offset"] - $limit) : "") . "'>zpět</a>\n"; 274 } 275 if ($pocet > $_GET["offset"] + $limit) { 276 echo "<a href='$_SERVER[PHP_SELF]?offset=" . ($_GET["offset"] + $limit) . "'>vpřed</a>\n"; 277 } 275 278 276 279 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); 286 282 if ($_GET["strana"]) { 287 283 echo "<a href='$_SERVER[PHP_SELF]" . ($_GET["strana"] != 1 ? "?strana=" . ($_GET["strana"] - 1) : "") . "'>zpět</a>\n"; … … 290 286 echo "<a href='$_SERVER[PHP_SELF]?strana=" . ($_GET["strana"] + 1) . "'>vpřed</a>\n"; 291 287 } 288 292 289 293 290 }
Note:
See TracChangeset
for help on using the changeset viewer.