include 'database.php';
// Datos de conexión a la base
$query="select NumPages as Page from Pages";
$link=mysql_connect($server,$dbuser,$dbpass);
$result=mysql_db_query($database,$query,$link);
$array2=mysql_fetch_array($result);
$Temp=$array2["Page"];
$base="markbased";
$con=mysql_connect($server,$dbuser,$dbpass);
mysql_select_db($base,$con);
if (!isset($pg))
$pg = 0; // $pg es la pagina actual
/*$cantidad=$Temp;*/
$cantidad=140; // cantidad de resultados por página
$inicial = $pg * $cantidad;
$pegar = "SELECT SiteName, LinkDescrip, Category, Priority, URLSite FROM info_links where Category='$Ref' and Active='1' ORDER BY Priority LIMIT $inicial,$cantidad";
$cad = mysql_db_query($base,$pegar) or die (mysql_error());
$Site=$array["SiteName"];
$Descrip=$array["LinkDescrip"];
$URLSite=$array["URLSite"];
$category=$array["Category"];
$priority=$array["Priority"];
$contar = "SELECT * FROM info_links where Category='$Ref' ORDER BY Priority";
$contarok= mysql_db_query($base,$contar);
$total_records = mysql_num_rows($contarok);
$pages = intval($total_records / $cantidad);
?>
while (list($SiteName, $LinkDescrip, $Category, $Priority, $URLSite) = mysql_fetch_row($cad)) {
echo '';
echo '
';
echo '';
?>
echo $SiteName;
echo ' |
';
echo $LinkDescrip;
echo '';
?>
echo $URLSite;
echo ' |
';
echo '';
$Si++;
}
?>
// Cerramos la conexión a la base
$con=mysql_close($con);
// Creando los enlaces de paginación
echo "";
if ($pg <> 0)
{
$url = $pg - 1;
echo " ";
}
else {
echo " ";
}
for ($i = 0; $i<($pages + 1); $i++) {
if ($i == $pg) {
echo " $i ";
}
else {
echo "".$i." ";
}
}
if ($pg < $pages) {
$url = $pg + 1;
echo "";
}
else {
echo " ";
}
echo "
";
?>