<?php
/*
*Exemplo de uso simples:
*/
require("paginacao.class.php");
$link = mysql_connect("localhost", "root", "");
if($link){
if (!mysql_select_db("bancoTeste", $link)) {
exit("It was not possible to select database: bancoTeste".
"<br>On Server:localhost".
"<br>With the user: root".
"<br>And the Password: '' ");
}
}else{
exit("Unable to login to Server: localhost".
"<br>With the user: root".
"<br>And the Password: '' ".
"<br>And so it is not possible to select the Database:bancoTeste");
}
$query2 = mysql_query("SELECT * FROM `tabela`");
$howMany = mysql_num_rows($query2);
$limit_on_earnings_per_page = 5;
$page = (isset($_GET["pg"])) ? $_GET["pg"] : 1;
$start = ($page != 0)? ($page - 1) * $limit_on_earnings_per_page : 0;
$query = mysql_query("SELECT * FROM `tabela` LIMIT $start, $limit_on_earnings_per_page;");
while($dados = mysql_fetch_array($query)){
Echo "Value of Field = ".$dados["campo"]."<br /> \n";
}
$instantiates = new paginacao();
$instantiates->configuracoesLogica["pg_Atual"] = $page;
$instantiates->configuracoesLogica["qntTroco"] = $howMany;
$instantiates->configuracoesTemplates["LINK"] = "<a style='text-decoration:none;' href='http://localhost/paginacao/exSimples.php?pg=###PAGINA###'><strong>###MENSAGEM###</strong></a> \n";
$instantiates->configuracoesTemplates["BLOCO"] = "<strong>[###INICIO###-###FIM###]</strong> \n";
$instantiates->configuracoesTemplates["PG_ATUAL"] = "<strong>###PAGINA###</strong> \n";
echo $instantiates->geraPaginacao();
?>
|