Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/10/2010, 16:20
Rene1607
 
Fecha de Ingreso: agosto-2010
Mensajes: 44
Antigüedad: 13 años, 8 meses
Puntos: 0
El while no se me ejecuta como debiera porque?

Buenas amigos necesito una mano tengo varios while dentro de un if pero el primero de ellos saca solo un dato de la tabla cuando debiera sacar todos los que haya seleccionado el SELECT..Seguro no estoy implementando el codigo de una buena manera..Muchas gracias al que pueda ayudarme...
Este es el codigo..

$result = mysql_query("SELECT ced_facilitador FROM facilitador_unidadcurricular where cod_unidadcurricular='$cod_unidadcurricular'");

if($row = mysql_fetch_row($result)){
echo "<table border='2' width='75%' align='center'>";
echo "<tr>";
echo "<td><b>Cedula del Facilitador</b></td>";
echo "<td><b>Nombre</b></td>";
echo "<td><b>Apellido</b></td>";
echo "<td><b>Unidad Curricular</b></td>";
echo "<td><b>Trayecto</b></td>";
echo "<td><b>Trimestre</b></td>";
echo "</tr>";


echo "<tr>";
while ($row = mysql_fetch_row($result)){
echo "<td>$row[0]</td>";
$ced_facilitador=$row[0];

$sqlm = mysql_query("SELECT nombre,apellido FROM facilitador where ced_facilitador='$ced_facilitador'");

while ($row = mysql_fetch_row($sqlm)){
echo "<td>$row[0]</td>";
echo "<td>$row[1]</td>";}
$sq = mysql_query("SELECT descripcion,trayecto,trimestre FROM unidadcurricular where cod_unidadcurricular='$cod_unidadcurricular'");
while ($row = mysql_fetch_row($sq)){
echo "<td>$row[0]</td>";
echo "<td>$row[1]</td>";
echo "<td>$row[2]</td>";
}

echo "</tr> ";
}
echo "</table>";





desconectar();

?>
<html>
<head>
<title>Consultas de Facilitadores/Unidades Curriculares</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body><br><br>

<form action="" method="get">
<table border='0' width='40%' align='center'>
<tr><td>
<input type="button" name="imprimir" value="Imprimir"Â* onClick="window.print();"/></td>
<td><input type="button" name="borrar" value="Regresar" onClick="window.history.go(-1);"/></td>
</tr>
</form>
</body>
</html>
<?php

}else{
echo '<script type="text/javascript">alert("Registro inexistente");</script>';
echo '<script type="text/javascript">window.history.go(-1);</script>';}

?>