![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
15/07/2008, 13:09
|
| | Fecha de Ingreso: marzo-2005
Mensajes: 156
Antigüedad: 19 años, 10 meses Puntos: 0 | |
Respuesta: consulta hola.
mira tengo esta consulta:
if ($pasar==1)
{
// acá debo realizar el insert dependiendo las cantidad de resultados que me trajo el listar. el parametro va ser el campo atra_alum_id, el cual debo pasarlo
según la cantidad de registro que me entrego el listar debo hacer el insert por cada uno, o sea pasando el id de cada atraso.
}
else
{
// consulta para ver datos del alumno
$sql="select inscripcion_alumno__inal.ALUM_RUT,
alumnos__alum.ALUM_NOMBRES,
alumnos__alum.ALUM_APELLIDO_PATERNO,
alumnos__alum.ALUM_APELLIDO_MATERNO,
inscripcion_alumno__inal.CURS_CURSO_ALUMNO
from alumnos__alum,inscripcion_alumno__inal
where inscripcion_alumno__inal.ALUM_RUT=alumnos__alum.AL UM_RUT
and alumnos__alum.ALUM_RUT='".$rut."'";
$res = mysql_query($sql) or die("La consulta falló: " . mysql_error());
$num=mysql_numrows($res);
//echo"$res";
for($i=0;$i<$num;$i++)
{
$rut=mysql_result($res,$i,"ALUM_RUT");
$nombres=mysql_result($res,$i,"ALUM_NOMBRES");
$txtapellidopaterno=mysql_result($res,$i,"ALUM_APE LLIDO_PATERNO");
$txtapellidomaterno=mysql_result($res,$i,"ALUM_APE LLIDO_MATERNO");
$txtcursoalumno=mysql_result($res,$i,"CURS_CURSO_A LUMNO");
}
//////////////////tabla para vizualizar los atrasos del Alumno
echo"<div>";
echo"<h2><center><strong><pre>Justifición del Alumno</pre></center></strong></h3>\n";
echo "<table width='41%' border='0' cellspacing='0' cellpadding='1'>";
echo "</table>";
//datos del alumno a justificar
echo"<table border='0' width='21%' align ='center'>\n";
echo"<tr bgcolor='#FFFFCC'>\n";
echo "<tr>";
echo"<td width='15%' cels><pre><strong>Alumno nombre:</strong> $nombres $txtapellidopaterno $txtapellidomaterno,</pre></td>\n";
echo"<td width='25%'><pre>con el <strong>Rut Alumno:</strong> $rut,</pre></td>\n";
echo "</tr>";
echo"<tr>";
echo"<td width='15%' colspan='2'><pre>el cual cual posee los siguientes atrasos:</strong></pre></td>\n";
echo "</tr>";
echo "</table>";
//----------------------------------------------------------------------------------------------------
//Select para mostrar información de los atrasos
$sql2="select atraso_alumnos__atra_alum.ATRA_ALUM_ID,
atraso_alumnos__atra_alum.ATRA_ALUM_MOTIVO,
atraso_alumnos__atra_alum.ATRA_ALUM_FECHA_REGISTRO ,
atraso_alumnos__atra_alum.ATRA_ALUM_HORA_REGISTRO,
atraso_alumnos__atra_alum.ATRA_ALUM_OBSERVACION
from inscripcion_alumno__inal, atraso_alumnos__atra_alum, alumnos__alum
where inscripcion_alumno__inal.ALUM_RUT=alumnos__alum.AL UM_RUT
and atraso_alumnos__atra_alum.ALUM_RUT=alumnos__alum.A LUM_RUT
and atraso_alumnos__atra_alum.ALUM_RUT='$rut'
and atraso_alumnos__atra_alum.ESTA_ATRA_ID =0 ";
$res2 = mysql_query($sql2) or die("La consulta falló: " . mysql_error());
$num2=mysql_numrows($res2);
mysql_close();
//echo"<center>\n";
echo"<form action='Apoderado_Justifica'pasar=1' method='post' name='Volver'>\n";
echo "<table width='900' height='88' border='1' cellpadding='2' cellspacing='2'>\n";
echo "<!--DWLayoutDefaultTable-->\n";
$semasforo=FALSE;
echo"<table width='41%' border='0' bgcolor='#FFFFCC' align='center' cellpadding='0' cellspacing='5'>\n";
echo"<tr> \n";
echo"<td width='25%'><div align='center'><pre><strong>Id Atraso</strong></pre></div></td>\n";
echo"<td width='25%'><div align='center'><pre><strong>Motivo Atraso</strong></pre></div></td>\n";
echo"<td width='25%'><div align='center'><pre><strong>Fecha Registro</strong></pre></div></td>\n";
echo"<td width='25%'><div align='center'><pre><strong>Hora Registro</strong></pre></div></td>\n";
echo"<td width='25%'><div align='center'><pre><strong>Obervación</strong></pre></div></td>\n";
echo"</tr>\n";
$a=0;
while ($a < $num2) {
if ($semasforo)
{
$color="#0033FF";
}
else
{
$color="#74CEFA";
}
$idatraso=mysql_result($res2,$a,"ATRA_ALUM_ID");
$motivoatraso=mysql_result($res2,$a,"ATRA_ALUM_MOT IVO");
$fecharegistro=mysql_result($res2,$a,"ATRA_ALUM_FE CHA_REGISTRO");
$horaregistro=mysql_result($res2,$a,"ATRA_ALUM_HOR A_REGISTRO");
$obsersacion=mysql_result($res2,$a,"ATRA_ALUM_OBSE RVACION");
echo"<tr bgcolor=$color>\n";
$c= $a+1;
echo"<td><pre>$c</pre></td>" ;
echo"<td><pre>$motivoatraso</pre></td>" ;
echo"<td><pre>$fecharegistro</pre></td>";
echo"<td><pre>$horaregistro</pre></td>" ;
echo"<td><pre>$obsersacion</pre></td>" ;
echo"<tr>\n";
$a++;
$semasforo=!$semasforo;
}//cierre if($semaforo)
echo"</table> \n";
echo "<br>";
echo"<table border=0 width=42% align='center'>";
echo"<tr>";
echo"<td><strong><pre>Registo de la justificación</pre></strong></td>";
echo"</tr>";
echo "</table>";
echo"<table border='0' width='19%' align='center' cellspacing='1'>\n";
echo"<tr>\n";
echo"<td width='15%'><pre>Justificación</pre></td>\n";
echo"<td width='34%' align='center'> <div align='left'>\n";
echo"<input name='txtcodJustificacion' type='text' value='' size='15'>\n";
echo"<td width='15%'><pre>Rut Apoderado</pre></td>\n";
echo"<td width='34%' align='center'> <div align='left'>\n";
echo"<input name='txtcurso' type='text' value='' size='15' maxlength='4'>\n";
echo"</div></td>\n";
echo"</tr>\n";
echo"<tr>\n";
// echo"<td width='15%'><pre>Atrasos</pre></td>\n";
//echo"<td width='34%' align='center'> <div align='left'>\n";
//echo"<input name='txtdescripcion' type='text' value='' size='15' maxlength='200'>\n";
echo"<td width='15%'><pre>Fecha justificación</pre></td>\n";
echo"<td width='34%' align='center'> <div align='left'>\n";
echo"<input name='txtdescripcion' type='text' value='' size='15' maxlength='200'>\n";
echo"</div></td>\n";
echo"</tr>\n";
echo"<tr>\n";
echo"<td width='15%'><pre>Descripción<br>justificaci ón</pre></td>\n";
echo"<td width='34%' align='center' colspan='3'> <div align='left' >\n";
//echo"<textarea name='txtdescripcion' rows=5 cols=10 style="overflow:auto;" ></textarea>";
echo"<textarea maxlength='200' name='txtdescripcion' cols='47' rows='3' onkeyup='return ismaxlength(this)'></textarea>";
echo"</div></td>\n";
echo"</tr>\n";
echo"</table>";
//echo "<p align='center'>\n";
echo "<br>";
echo "<center><input type='submit' name='btnjustificar' value='Justificar Alumno'></center>\n";
echo"</form>\n";
echo"</body>\n";
echo"</html>\n";
el cuan me extrae un listado con todos los registros existentes. |