Cita:
Iniciado por gesking
Hola gente, tengo un problemita... se me genera un bucle sin fin... infinito...
Yo solo quiero mostrar las ultimas 2 notas publicadas y me muestra 1 sola infinitamente....
Este es mi codigo, que hago mal?
Código PHP:
<?
$con_n = mysql_query("SELECT * FROM radio_notas WHERE periodista = 'nestor' ORDER BY id DESC LIMIT 0, 3");
$total_registros = mysql_num_rows($con_n);
?>
<ol start="1" type="1">
<?
$mostrar_n = mysql_fetch_array($con_n);
if($total_registros==0){
echo'No hay notas por el momento';
}else{
while($mostrar_n){
echo '<li><a href="completa.php?id='.$mostrar_n[id].'">'.$mostrar_n[titulo].'</a></li>';
}
}
?>
</ol>
Gracias
por que al retornarte el valor, es un true, y se mete al bucle infinito..... intenta asi:
Código PHP:
<?php
$con_n = mysql_query("SELECT * FROM radio_notas WHERE periodista = 'nestor' ORDER BY id DESC LIMIT 0, 3");
$total_registros = mysql_num_rows($con_n);
echo '<ol start="1" type="1">';
if($total_registros<=0){
echo 'No hay notas por el momento';
}else{
while($mostrar_n=mysql_fetch_array($con_n)){
echo '<li><a href="completa.php?id='.$mostrar_n[id].'">'.$mostrar_n[titulo].'</a></li>';
}
}
echo '</ol>';
?>