Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/09/2009, 20:01
geoxxx
 
Fecha de Ingreso: junio-2009
Mensajes: 21
Antigüedad: 14 años, 10 meses
Puntos: 0
Problema con consulta

Código:
$resultN=mysql_query("select * from nota where postgrado='$codigo' and año=$año"); $resultA=mysql_query("select * from datos_alumno ORDER BY apellido ASC"); 
while ($not=mysql_fetch_array($resultN)) {
while ($part=mysql_fetch_array($resultA)){ 
if ($part['cedula'] == $not['cedula']){ 
$i= $i + 1;
 echo "<tr>"; 
echo "<td>$i</td>"; 
echo "<td>$part[apellido], $part[nombre]</td>";
 echo "<td>$part[cedula]</td>";
 echo "<td><img src='$part[foto]'></td>";
 echo "<td><input type='text' name='nota' id='inputnota' class=\"validate['number']\" maxlength='2' value='$not[$no]'></td>"; 
echo "</tr>"; 
} 
} 
}
Existe alguna manera de liberar la variable $part para no repetir tanto la consulta, ya que puede ocupar mucho espacio…..

Código:
$resultN=mysql_query("select * from nota where postgrado='$codigo' and año=$año"); 
while ($not=mysql_fetch_array($resultN)) {
 ///ojo cuando repito el querry aca si funciona
$resultA=mysql_query("select * from datos_alumno ORDER BY apellido ASC"); 
while ($part=mysql_fetch_array($resultA)){ 
if ($part['cedula'] == $not['cedula']){ 
$i= $i + 1;
 echo "<tr>"; 
echo "<td>$i</td>"; 
echo "<td>$part[apellido], $part[nombre]</td>";
 echo "<td>$part[cedula]</td>";
 echo "<td><img src='$part[foto]'></td>";
 echo "<td><input type='text' name='nota' id='inputnota' class=\"validate['number']\" maxlength='2' value='$not[$no]'></td>"; 
echo "</tr>"; 
} 
} 
}