Eu tenho uma páginação de fotos que funcionava bem até dia desse, tive que formatar o pc e qdo retornei a trabalhar nela, notei que não exibe corretamente as fotos, a formatação não alterou o código, mas não consigo encontrar o erro por isso peço ajuda.
O erro é o seguinte:
coluna 1 exibe as minis (10 por vez) e na coluna 2 a foto maior.
tenhos os links Anterior - 1 - 2 - 3 - 4 - 5 - Próxima para exibir mais fotos minis
qdo mudo de pag (link 2 por exemplo) e clico em uma mini p exibir no centro, ela carrega as imagens do link 1 ao inves de conitnuar com as minis do link 2 em questão.
A pagina para vcs verem esta aqui:
http://pousadadoteno....br/galeria.php
E o code dela aqui:
<?php //conecta o mysql include "conexao.php"; $id = $_GET['id']; if ($id){ $resultado = mysql_query("select * from tabela where id = '$id' "); $galeria = mysql_fetch_array($resultado); mysql_close(); } else{ $resultado = mysql_query("select * from tabela order by id asc"); $galeria = mysql_fetch_array($resultado); mysql_close(); }?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title> Galeria de Fotos </title><link href="css/fotos.css" rel="stylesheet" type="text/css" /></head><body> <div id="geral"> <div id="content"> <h1>Pousada do Tenório - Galeria de fotos</h1> <div id="galeria"> <?php include "conexao/conecta.php"; //link por page $link_p_pag = 3; //registros por page $reg_p_pag = 10; $pag = $_GET['pag']; //busca no banco $busca = mysql_query("SELECT count(*) FROM tabela;"); $registros = mysql_result($busca,0); $num_total_paginas = ($registros%$reg_p_pag==0)?$registros/$reg_p_pag:floor($registros/$reg_p_pag)+1; if ($pag>$num_total_paginas) echo "Erro<br><br>"; else if (!$pag) $pag = 1; $inicio = ($reg_p_pag*$pag)-$reg_p_pag; //echo "Inicia em: $inicio<br><br>"; //faz a busca no banco $query = "SELECT * FROM tabela ORDER BY id ASC LIMIT $inicio, $reg_p_pag"; $result = mysql_query($query); echo "<ul class='fotos'>"; while ($row = mysql_fetch_assoc($result)) { $id = $row['id']; $foto = $row["foto"]; $mini = $row["mini"]; echo "<li><a href=\"galeria.php?id=$id\">"; echo '<img src="fotos/galeria/mini/'.$mini.' " alt="Galeria de Fotos" >'; echo "</a>"; echo "</li>"; } echo "</ul>"; //links paginação echo "<p>"; $anterior = $pag-1; if ($anterior<1) echo "Anterior - "; else echo "<a href=\"{$_SERVER['PHP_SELF']}?pag=$anterior\">Anterior</a> - "; for($i=1; $i<$pag; $i++) if($i>=$pag-$link_p_pag) echo "<a href=\"{$_SERVER['PHP_SELF']}?pag=$i\">$i</a> - "; echo "<b>$pag</b>"; for($i=$pag+1; $i<=$num_total_paginas; $i++) if($i<=$pag+$link_p_pag) echo " - <a href=\"{$_SERVER['PHP_SELF']}?pag=$i\">$i</a>"; $proxima = $pag+1; if ($proxima>$num_total_paginas) echo " - Próxima"; else echo " - <a href=\"{$_SERVER['PHP_SELF']}?pag=$proxima\">Próxima</a>"; echo "</p>"; ?> </div> <!--galeria--> <div id="foto_G"> <div class="img-centro"> <?php $foto = $galeria ["foto"]; echo '<img src="fotos/galeria/'.$foto.' " alt="galeria" >'; ?> </div> <!--img centro--> <div id="legenda"> <?php echo $galeria["legenda"];?> </div> </div> <!--foto_G--> </div><!--content--> <?php include("inc/rodape.php"); ?> </div></body></html>
Agradeço toda ajuda.