Jump to content


michelmfreitas's Content

There have been 26 items by michelmfreitas (Search limited from 30/03/2023)



Ordernar por                Order  

#897039 Problema Com Paginação

Posted by michelmfreitas on 12/02/2008, 16:06 in PHP

Olá pessoal, estou com uma dúvida na paginação do meu site, ele lista a página, enumera-as, mas quando clico, não vai para as próximas notícias. Por que?

<?
	if($acao == ''){ 
	
		if(!isset($pag)){
			$pg = 0; 
			$inicial = $pag * 3; //3 é o num de resultados por tela
			$sql = "SELECT * FROM noticias ORDER BY id DESC LIMIT $inicial, 5";
			$result = $conn->Execute($sql);
			$totalReg = $result->NumRows(); //total de registros
			$pages = intval($totalReg/3); //total de paginas
			while($txt = $result->FetchRow()){?>
			
				<div class="dvalbum2">
				
					<img src="<?=$txt['miniatura']?>"/>
					<h5><?=$txt['titulo']?></h5>
				
				</div>
			
			<? } //fecha while
			
		}?>
		
		<br style="clear:both;" />	
		<div id="paginacao">	
			
		<?
			if ($pg <> 0) {
				$url = $pg - 1;
				  echo "<a id=mulink href='?pagina=noticias&pg=$url'>5 anteriores</a> ";
			}else{
				echo " ";
			}
				
			for ($i = 0; $i<($pages + 1); $i++) {
				if ($i == $pg) {
					echo "<font face=Arial size=2 color=ff0000><b>&nbsp;&nbsp;$i&nbsp;&nbsp;</b></font>";
				} else {
				   echo "<a id=mulink href='?pagina=noticias&pg=$i'>&nbsp;&nbsp;$i&nbsp;&nbsp;</a>";
				}
			}
			
		?>
		</div>
<? } ?>




IPB Skin By Virteq