mayconvm Posted November 6, 2004 Report Share Posted November 6, 2004 alguém pode me informar o q a de errado!!!!ele n que exibir a pagina, fica com erro, e onde era para aparecer a menssagem e nome, melhor dizendo tudo... n quer aparecer nada...<?php require ("funcoes.php"); require ("js/fasttemplate.php"); require ("js/paginacao.php"); $nav = new Paginacao($total_reg,2); $blog = new FastTemplate('blog/1'); $blog->define(array('pagina' => 'index.htm')); include ("conect.php"); $sql2 = mysql_query("select * from menssagens where home='$pag' "); $tr = mysql_num_rows($sql2); $nav->query("SELECT * FROM messagens ORDER BY id DESC"); // pra q serve esse comando... if($tr == 0){ echo "Erro no banco de dados..." } else{ while ($resultado=$nav->result_assoc()) { $blog->assign('{menssagen}',codifica_url(filtro(quebra_linha(stripslashes($resultado['menssagem']))))); $blog->assign('{nome}', stripslashes(strip_tags($resultado['nome'], '<i>'))); $blog->assign('{titulo}', stripslashes(strip_tags($resultado['titulo'], '<i>'))); $blog->assign('{email}', stripslashes(strtolower(strip_tags ($resultado['email'])))); } } if(!$_GET['pagina']) $pc = "1"; else $pc = $_GET['pagina']; $blog->assign('{Nav4}', $pc); $blog->parse('OUTPUT','pagina'); $blog->FastPrint('OUTPUT'); ?> Quote Link to comment Share on other sites More sharing options...
0 Fabyo Posted November 6, 2004 Report Share Posted November 6, 2004 Que mensagem de erro que aparece? Quote Link to comment Share on other sites More sharing options...
0 mayconvm Posted November 6, 2004 Author Report Share Posted November 6, 2004 o erro e esse qui...Warning: Division by zero in d:\arquivos de programas\easyphp\www\test\blog\js\paginacao.php on line 37Errofunction query($query){ // Somente Seleciona if(!preg_match("/^[\s]*select*/i",$query)){ $query="select ".$query; } // Filtra a Query $query_temp=preg_replace("/select .* from (.*)/si","select count(*) from \\1",$query); $result_temp=mysql_query($query_temp) or die ("Erro de Query"); list($this->p["count"]) = mysql_fetch_row($result_temp); // Total de Páginas $this->p["total_pagina"]=ceil($this->p["count"]/$this->p["max_pagina"]); // Filtra Página if($this->pagina<=1) $this->pagina=1; elseif($this->pagina>$this->p["total_pagina"]) $this->pagina=$this->p["total_pagina"]; // Query $this->p["nav"]=$this->pagina*$this->p["max_pagina"]-$this->p["max_pagina"]; $query=$query." limit ".$this->p["nav"].",".$this->p["max_pagina"]; $query=mysql_query($query) or die("Erro"); $this->query=$query; } Quote Link to comment Share on other sites More sharing options...
0 Gladisson Posted November 6, 2004 Report Share Posted November 6, 2004 Poste a lina 37 de paginação.php Quote Link to comment Share on other sites More sharing options...
0 mayconvm Posted November 6, 2004 Author Report Share Posted November 6, 2004 $this->p["total_pagina"]=ceil($this->p["count"]/$this->p["max_pagina"]); Quote Link to comment Share on other sites More sharing options...
0 Fabyo Posted November 6, 2004 Report Share Posted November 6, 2004 paginacao.php on line 37posta o script paginacao.php o erro ta nessa linha 37 Quote Link to comment Share on other sites More sharing options...
0 mayconvm Posted November 6, 2004 Author Report Share Posted November 6, 2004 esse e o comando q ela executa function query($query){ // Somente Seleciona if(!preg_match("/^[\s]*select*/i",$query)){ $query="select ".$query; } // Filtra a Query $query_temp=preg_replace("/select .* from (.*)/si","select count(*) from \\1",$query); $result_temp=mysql_query($query_temp) or die ("Erro de Query"); list($this->p["count"]) = mysql_fetch_row($result_temp); // Total de Páginas $this->p["total_pagina"]=ceil($this->p["count"]/$this->p["max_pagina"]); // alinha 37 e essa qui... // Filtra Página if($this->pagina<=1) $this->pagina=1; elseif($this->pagina>$this->p["total_pagina"]) $this->pagina=$this->p["total_pagina"]; // Query $this->p["nav"]=$this->pagina*$this->p["max_pagina"]-$this->p["max_pagina"]; $query=$query." limit ".$this->p["nav"].",".$this->p["max_pagina"]; $query=mysql_query($query) or die("Erro"); $this->query=$query; } Quote Link to comment Share on other sites More sharing options...
0 Fabyo Posted November 6, 2004 Report Share Posted November 6, 2004 esse seu script tem 23 linhas e o erro ta no script paginacao.php linha 37deve ter uma soma errada la por isso ele diz que não pode ser divizivel por zero Quote Link to comment Share on other sites More sharing options...
0 mayconvm Posted November 6, 2004 Author Report Share Posted November 6, 2004 esse e todo o script da pagina...<?php class Paginacao{ var $inter4u; var $p; var $pagina; var $q; var $query; var $anterior; var $proximo; var $numero; function paginacao($max_pagina=5, $max_link=5, $proximo="Anterior", $anterior="Próxima", $numero="%%numero%%"){ $this->next=$anterior; $this->prev=$proximo; $this->numero=$numero; $this->p["max_pagina"]=$max_pagina; $this->p["max_link"]=$max_link; $_SERVER["QUERY_STRING"]=preg_replace("/pagina=[0-9]*/","",$_SERVER["QUERY_STRING"]); if(empty($_GET["pagina"])){ $this->pagina=1; } else{ $this->pagina=$_GET["pagina"]; } } function query($query){ // Somente Seleciona if(!preg_match("/^[\s]*select*/i",$query)){ $query="select ".$query; } // Filtra a Query $query_temp=preg_replace("/select .* from (.*)/si","select count(*) from \\1",$query); $result_temp=mysql_query($query_temp) or die ("Erro de Query"); list($this->p["count"]) = mysql_fetch_row($result_temp); // Total de Páginas $this->p["total_pagina"]=ceil($this->p["count"]/$this->p["max_pagina"]); // Filtra Página if($this->pagina<=1) $this->pagina=1; elseif($this->pagina>$this->p["total_pagina"]) $this->pagina=$this->p["total_pagina"]; // Query $this->p["nav"]=$this->pagina*$this->p["max_pagina"]-$this->p["max_pagina"]; $query=$query." limit ".$this->p["nav"].",".$this->p["max_pagina"]; $query=mysql_query($query) or die("Erro"); $this->query=$query; } function result(){ return $result=mysql_fetch_object($this->query); } function result_assoc(){ return mysql_fetch_assoc($this->query); } function print_no(){ $numero=$this->p["nav"]+=1; return $numero; } function print_info(){ $pagina=array(); $pagina["inicio"]=$this->p["nav"]+1; $pagina["fim"]=$this->p["nav"]+$this->p["max_pagina"]; $pagina["total"]=$this->p["count"]; $pagina["total_paginas"]=$this->p["total_pagina"]; if($pagina["fim"] > $pagina["total"]) { $pagina["fim"]=$pagina["total"]; } if(empty($this->p["count"])) { $pagina["inicio"]=0; } return $pagina; } function print_link(){ // Gera Template function numero($i,$numero){ return ereg_replace("^(.*)%%numero%%(.*)$","\\1$i\\2",$numero); } $print_link = false; if($this->p["count"]>$this->p["max_pagina"]){ // Imprime Anterior if($this->pagina>1) $print_link .= "<a href=\"".$_SERVER["PHP_SELF"]."?pagina=".($this->pagina-1)."\">".$this->prev."</a>\n"; // Seta Número $this->p["bawah"]=$this->pagina-$this->p["max_link"]; if($this->p["bawah"]<1) $this->p["bawah"]=1; $this->p["atas"]=$this->pagina+$this->p["max_link"]; if($this->p["atas"]>$this->p["total_pagina"]) $this->p["atas"]=$this->p["total_pagina"]; // Imprime Início if($this->pagina<>1){ for ($i=$this->p["bawah"];$i<=$this->pagina-1;$i++) if(numero($i,$this->numero)<10) $print_link .="<a href=\"".$_SERVER["PHP_SELF"]."?pagina=$i\">[0".numero($i,$this->numero)."]</a>\n"; else $print_link .="<a href=\"".$_SERVER["PHP_SELF"]."?pagina=$i\">[".numero($i,$this->numero)."]</a>\n"; } // Imprime Ativo if($this->p["total_pagina"]>1) if(numero($this->pagina,$this->numero)<10) $print_link .= "<b>[0".numero($this->pagina,$this->numero)."]</b>\n"; else $print_link .= "<b>[".numero($this->pagina,$this->numero)."]</b>\n"; // Imprime FIm for ($i=$this->pagina+1;$i<=$this->p["atas"];$i++) if(numero($i,$this->numero)<10) $print_link .= "<a href=\"".$_SERVER["PHP_SELF"]."?pagina=$i\">[0".numero($i,$this->numero)."]</a>\n"; else $print_link .= "<a href=\"".$_SERVER["PHP_SELF"]."?pagina=$i\">[".numero($i,$this->numero)."]</a>\n"; // Imprime Próximo if($this->pagina<$this->p["total_pagina"]) $print_link .= "<a href=\"".$_SERVER["PHP_SELF"]."?pagina=".($this->pagina+1)."\">".$this->next."</a>\n"; return $print_link; } } } ?> Quote Link to comment Share on other sites More sharing options...
0 Gladisson Posted November 6, 2004 Report Share Posted November 6, 2004 você não esta dando valor para: $this->p["max_pagina"] Quote Link to comment Share on other sites More sharing options...
0 mayconvm Posted November 6, 2004 Author Report Share Posted November 6, 2004 você sabe como eu faço para mim retirar essa parte do script...já esta me dando uma dor de cabeça.... Quote Link to comment Share on other sites More sharing options...
Question
mayconvm
alguém pode me informar o q a de errado!!!!
ele n que exibir a pagina, fica com erro, e onde era para aparecer a menssagem e nome, melhor dizendo tudo... n quer aparecer nada...
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.