TENGO EL SIGUIENTE SCRIPT PARA REGISTRAR LA ASISTENCIA DEL DOCENTE EN ESTE CASO, PERO SOLO ME FUNCIONA PARA UN SOLO REGISTRO, OSEA REGISTRA LA ENTRADA Y SALIDA PARA UN SOLO REGISTRO PERO EL DOCENTE, TIENE POR EJEMPLO 3 ASISTENCIAS EL DIA DE HOY Y NECESITO IMPLEMENTAR PARA ESAS 3 ASISTENCIAS QUE TIENE , PARA LO CUAL ESTOY INTENTANDO FILTRAR POR EL CODIGO DE ASISTENCIA, PERO SOLO ME FUNCIONA PARA UN REGISTRO...
TENGO LA TABLA ASISTENCIA_PERSONAL
COD_ASISTENCIA - COD_PERSONAL - HORA_ENTRADA_REAL - HORA_SALIDA_REAL ....
Código PHP:
$cod_profesor=$_GET['cod_profesor'];
//$fechaentrada=$_GET['fechaentrada'];
$fechaentrada=$fecha_hoy=gmdate("Y-m-j",time() + (3600 * (-5)) + $ajustesegundos);
$conexion=abrir_conexion();
$cadx="Select * from asistencia_personal where cod_personal='$cod_profesor' and dia='$fechaentrada' order by hora_inicio";
$resultx = mysql_query($cadx,$conexion);
$rowx=mysql_fetch_array($resultx);
$cad="Select * from asistencia_personal where cod_asistencia='".$rowx['cod_asistencia']."' and dia='$fechaentrada' order by hora_inicio";
$time = gmdate("h:i:s a",time() + (3600 * (-5)) + $ajustesegundos);
$dia= date("w");
$result = mysql_query($cad,$conexion);
if ($row=mysql_fetch_array($result)){
if (strcmp($row["hora_entrada_real"],"")==0){
if(strtotime($row['hora_inicio'])>=strtotime($time)){
$estado="P";
}else{
$estado="T";
}
$cad="update asistencia_personal set hora_entrada_real='".$time."', cod_usuario=".session_is_registered('cod_usuario').", hora_salida_real='', estado='$estado' where cod_personal='$cod_profesor' and dia='$fechaentrada' and cod_asistencia='".$rowx['cod_asistencia']."'";
$result2=mysql_query($cad,$conexion) or die("No se realizo el registro");
}
else{
$cad="update asistencia_personal set diafin='$fechaentrada', hora_salida_real='".$time."', cod_usuario=".session_is_registered('cod_usuario')." where cod_personal='$cod_profesor' and cod_asistencia='".$rowx['cod_asistencia']."'" ;
$result2=mysql_query($cad,$conexion) or die("No se realizo el registro");
}
}