Ver Mensaje Individual
  #7 (permalink)  
Antiguo 07/02/2008, 17:16
frins89
 
Fecha de Ingreso: febrero-2008
Mensajes: 72
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: Problema con el uso de limit para dividir en pagina los mensajes de un foro

Buenas, yo tngo el siguiente problema, he puesto lo k habeis dicho, pues yo tambien hago el mismo foro, (vamos a la misma clase XD) y weno la cuestion es k me liado vastante y a mi me muestra las paginas, pero no me divide los temas y ademas, me los muestra todos, por lo que me gustaria saver como hacer que me funcione, dejo aqui mi codigo
Código PHP:
<a href="index.php"  ><img src="./volver.png"  border="0"></a>
<table bgcolor="fff6a3" width="800" align="center">
<tr background="./titema.jpg"><td width="600"><font color="red" >Titulo </td>
<td witdh="100" > <font color="red" >Autor</td>
<td witdh="100"> <font color="red" >Fecha</td>

</tr>
<?php
mysql_connect
("localhost","root","");
mysql_select_db("foro");
$categoria$_GET["cate"];
$sql="Select * from tema where id_categoria=$categoria";
$resul=mysql_query($sql);
$muestra=mysql_num_rows($resul);
$to=$muestra/20;
$n 0;

$to="select * from tema";
$nu=mysql_query($to);
$to mysql_num_rows($nu);
$cuant=10
$n_pag ceil($to $cuant );

if(!isset(
$_GET['pag']))
{
$actual 1; }
else
{
$pag_actual=$_GET['pag'];
}
$ini=$actual*$cuant;


$sql="select * from tema limit $in,$cuant";

$result=mysql_query($sql);

$ura='';


while (
$temamysql_fetch_array($resul))
{
if (
$n%== 0)
{
$color="./tema1.jpg";
$n++;
}
else
{
$color="./tema2.jpg";
$n++;
}

?>
<tr background="<?php echo $color ?>"><td> <img src="./1.png"> <a href="ver_tema.php?tem=<?php echo $tema['id_tema']?>&cate=<?php echo $categoria?>"><?php echo $tema['titulo'?></a></td>
<td ><?php echo $tema['autor'?> </td>
<td > <?php echo $tema['fecha'?></td>

<?php 
}

echo 
"<tr background=\"./titema.jpg\"><td><font color=\"shadow\">Hay "mysql_num_rows($resul)." tema</tr></td>";

mysql_free_result($resul);
mysql_close();
?>
</td><td>
<?php
for ($ii=1$ii<=$n_pag $ii++) 
{
if (
$ii == $num_pag ) {
$ura .= '<strong>'.$ii.'</strong> ';
}else {
$ura .= '<a href="temas.php?cate='.$_GET["cate"] .'&pag='.$ii.'">'.$ii.'</a> ';
}

echo 
$ura;
?>
</td></tr>
</table>
dejo tambien las tablas para que se vea bien lo que kiero hacer. Gracias y espero ansioso la respuesta