Código:
Existe alguna manera de liberar la variable $part para no repetir tanto la consulta, ya que puede ocupar mucho espacio…..$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>"; } } }
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>"; } } }