Foros del Web » Programando para Internet » PHP »

While que no despliega result.

Estas en el tema de While que no despliega result. en el foro de PHP en Foros del Web. Amigos. Hago una consulta para traer un conjunto de datos y estos puedan ser desplegados en una tabla. Código PHP: $consulta = mysql_query ( "SELECT nombre_file,tipo_file,peso_file,com_file,fecha_file,publicado_por  ...
  #1 (permalink)  
Antiguo 30/11/2005, 11:45
 
Fecha de Ingreso: abril-2005
Mensajes: 491
Antigüedad: 19 años
Puntos: 1
While que no despliega result.

Amigos.

Hago una consulta para traer un conjunto de datos y estos puedan ser desplegados en una tabla.
Código PHP:
$consulta=mysql_query("SELECT nombre_file,tipo_file,peso_file,com_file,fecha_file,publicado_por 
FROM tbarchivo where tbusuario_id_user='$patron'"
)or die(mysql_error()); 
Después dentro de la misma página. hago el despliegue de datos.

Código HTML:
<?PHP
while($salida = mysql_fetch_array($consulta)) { 
?>
<td height="22"><div align="center"><?PHP echo $b++ ?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[nombre_file])?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[tipo_file])?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[fecha_file])?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[peso_file])?></div></td>
<td height="22"><div align="center"><img src="../../ICON/Lupa2.JPG" alt="<?= ucfirst($salida[com_file])?>" width="20" height="20" align="baseline"></div></td>
<td height="22"><div align="center"><a href="../DESCARGA/descarga.php?urldir=<?PHP echo $ruta; ?>&filename=<?=$salida[nombre_file]?>"><img src="../../ICON/download.gif" alt="Descargar" width="27" height="27" border="0" align="baseline"></a></div></td>
</tr>
<?PHP 
} //Cierre While ?> 
Y así como esta no me despliga ningun resultado, porque aparentemente no esta entrando al while, lo acabo de probar con un mensaje tipo echo "no entra al bucle"

Última edición por under_ground; 30/11/2005 a las 12:30
  #2 (permalink)  
Antiguo 30/11/2005, 12:05
 
Fecha de Ingreso: junio-2005
Mensajes: 29
Antigüedad: 18 años, 10 meses
Puntos: 0
Prueba con esto

Si tienes un solo resgitro en la tbla no te funcionara prueba asi:


Código PHP:
$consulta=mysql_query("SELECT nombre_file,tipo_file,peso_file,com_file,fecha_file,publicado_por 
FROM tbarchivo where tbusuario_id_user='$patron'"
)or die(mysql_error()); 
Después dentro de la misma página. hago el despliegue de datos.

Código HTML:
<?PHP
do { 
?>
<td height="22"><div align="center"><?PHP echo $b++ ?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[nombre_file])?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[tipo_file])?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[fecha_file])?></div></td>
<td height="22"><div align="center"><?=ucfirst($salida[peso_file])?></div></td>
<td height="22"><div align="center"><img src="../../ICON/Lupa2.JPG" alt="<?= ucfirst($salida[com_file])?>" width="20" height="20" align="baseline"></div></td>
<td height="22"><div align="center"><a href="../DESCARGA/descarga.php?urldir=<?PHP echo $ruta; ?>&filename=<?=$salida[nombre_file]?>"><img src="../../ICON/download.gif" alt="Descargar" width="27" height="27" border="0" align="baseline"></a></div></td>
</tr>
<?PHP 
} while($salida = mysql_fetch_array($consulta))?> 
  #3 (permalink)  
Antiguo 30/11/2005, 13:06
 
Fecha de Ingreso: abril-2005
Mensajes: 491
Antigüedad: 19 años
Puntos: 1
Solucionado, se me habia escapado una letra y no traía nada la variable $patron, por lo mismo no mostraba nada, Gracias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:03.