Code: Select all
$length = 25;
if(isset($_GET["pag"]))
$start = ($_GET["pag"] * $length) - $length;
else
{
$start = 0;
$pag = 1;
}
if($_GET["pag"] == 0)
{
$start = 0;
$pag = 1;
}
$cantidad = array();
$cons = new BaseDatos;
$cons->connect();
$sql = "select count(*) as numero from sitios_utiles where activo=1 and categoria=$id";
//echo $sql. "-----<br>";
$res = $cons->query($sql);
if($dato = $cons->fetch_row($res)) {
array_push($cantidad,$dato);
}
//print_r($cantidad);
$numero = $cantidad[0][0];
//echo "<br>$sql <br> el numero de noticias es $numero";
$numero_paginas = ceil($numero/$length);
//echo "<br> NUmero de paginas que resultan => " . $numero_paginas;
$cons = new BaseDatos;
$cons->connect();
$sql = "select top $length * from sitios_utiles where activo=1 and categoria=$id order by orden DESC, nombre ASC";
//echo "<br>" . $sql;
$res = $cons->query($sql);
if ($cons->fetch_row($res) > 0){
$hay = "si";
}
if($hay == "si" and $numero_paginas > 1) { ?>
</p>
<div align="center"> <span class="azul_txtblanco">Mas Sitios > </span>
<span class="tabla-general">
<?
for ($i=1; $i<=$numero_paginas; $i++)
{
if ($_GET["pag"] == $i)
echo $i." ";
else { ?>
<a href="<? echo $PHP_SELF ?>?id=<? echo $id ?>&pag=<? echo $i ?>"><? echo $i ?></a>
<? }
}Thanks
feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]