PAGINAÇÃO ORIENTADO A OBJETOS
Bom pessoal eu tenho um bom conhecimento em php, agora ele a objetos estou aprendendo agora, uma dúvida que eu tenho é sobre isso , estou tentando fazer uma paginação e creio que não estou conseguindo, se alguem puder me ajudar agradeço muito.
CÓDIGO PRINCPAL
Código PHP:
class testeDuplicata
{
public $servidor;
public $login;
public $senha;
public $dB;
public $NumeroDuplicata;
public $conexao;
public $inicio = 5;
public $quantidade = 10;
function conectarBanco() {
$this->conexao = new mysqli($this->servidor, $this->login, $this->senha, $this->dB);
if ($this->conexao->connect_error) {
die("Impossivel se conectar com o banco MYSQL " . $this->conexao->connect_error);
}
}
function ObtendoQuantidadeRegistros($CnpjCpfUsuario){
$sql = $this->conexao->prepare("SELECT COUNT(id) as qtdReg from Duplicatas dpl where dpl.cnpjCpfUsuario = '$CnpjCpfUsuario'");
$sql->execute();
$sql->bind_result($qtdReg);
$sql->fetch();
}
function ObtendoListaPeloCnpjCpf($CnpjCpfUsuario, $inicio, $quantidade){
$instrucao = "SELECT NumeroDuplicata, CnpjCpfUsuario from Duplicatas dpl where dpl.CnpjCpfUsuario = '$CnpjCpfUsuario' limit $inicio, $quantidade";
$resultado = $this->conexao->query($instrucao);
return $resultado;
CODIGO ONDE VAI PUXAR DAR VALORES A ESSES RESULTADOS
Código PHP:
$tpl = new testeDuplicata();
$tpl->servidor = "localhost";
$tpl->login = "root";
$tpl->senha = "tcmm01052013";
$tpl->dB = "duosigco_padrao";
$tpl->conectarBanco();
$listas = $tpl->ObtendoQuantidadeRegistros('55908560600');
$res = $tpl->ObtendoListaPeloCnpjCpf('55908560600',$tpl->inicio, $tpl->quantidade);
$SQL_COUNT = mysql_query($CnpjCpfUsuario);
@$SQL_RESUL = ceil(mysql_result($SQL_COUNT, 0) / $tpl->quantidade);
$start = ($pg - 1 ) * $tpl->quantidade;
while ($resultSet = $res->fetch_object()) {
echo "<br><b> dplic ".$resultSet->NumeroDuplicata;
echo "<br><b>duplic ".$resultSet->CnpjCpfUsuario;
}
Se puderem me ajudar vlw ;-)