Foros del Web » Creando para Internet » HTML »

Control de Asistencia phpy mysql Ayuda!!!

Estas en el tema de Control de Asistencia phpy mysql Ayuda!!! en el foro de HTML en Foros del Web. Hola amigos tengo una aplicacion que me muestra en pantalla los registros de una tabla para un control de asistencia que seria esta: <? require_once('class/clsAsistencia.php'); ...
  #1 (permalink)  
Antiguo 02/03/2011, 18:36
 
Fecha de Ingreso: marzo-2011
Mensajes: 1
Antigüedad: 13 años, 1 mes
Puntos: 0
Control de Asistencia phpy mysql Ayuda!!!

Hola amigos tengo una aplicacion que me muestra en pantalla los registros de una tabla para un control de asistencia que seria esta:

<?
require_once('class/clsAsistencia.php');
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>


<body bgcolor="#FCFFAC">
<h6><fieldset>
<strong>
<div id="header" align="center"><br>
<p>REPUBLICA BOLIVARIANA DE VENEZUELA<br />
MINISTERIO DE EDUCACION Y DEPORTES<br />
E.B.B. "ISIDRO RAMON MORENO"<br />
PALO NEGRO - ESTADO ARAGUA</p>
</div>
</strong>
<div align="center">
<a href="menu.html"><img src="imagenes/cerrar.png" alt="" /></a>

</div>
<?
$link = mysql_connect("localhost","root","");

mysql_select_db("escuela", $link);

$result = mysql_query("SELECT fecha, nombre, hora FROM asistencia", $link);

if ($row = mysql_fetch_array($result)){

echo "<table border = '1'> \n";

echo "<tr> \n";

echo "<td><b>Fecha</b></td> \n";

echo "<td><b>Nombre y Apellido</b></td> \n";

echo "<td><b>Hora</b></td> \n";

echo "</tr> \n";

do {


echo "<tr> \n";

echo "<td>".$row["fecha"]."</td> \n";

echo "<td>".$row["nombre"]."</td>\n";

echo "<td>".$row["hora"]."</td>\n";


echo "</tr> \n";

}

while ($row = mysql_fetch_array($result));

//echo "</table> style= margin-left: 50"> echo "</table> \n";

} else {

echo "La base de datos esta vacia!";

}

?>


</body>
<h6><fieldset>
</html>

Me corre perfectamente! la misma se desprende de la siguiente clase:

<?
//ARCHIVOS REQUERIDOS
class Asistencia {
//LOS ATRIBUTOS
private $dia;
private $mes;
private $a;
private $hora;
private $nombre;
// LOS METODOS
// PRIMERO EL CONSTRUCTOR
function __construct($d,$m,$a,$h,$n){

$this->dia=$d;
$this->mes=$m;
$this->a=$a;
$this->hora=$h;
$this->nombre=$n;
}
function imprimir() {
parent::imprimir();
echo"FECHA".$fecha."<br />\n";
echo"HORA".$this->hora."<br />\n";
echo"NOMBRE".$this->nombre."<br />\n";
}

function agregar(){
// POR FIN QUESO A LA TOSTADA DE ESTE CURSO
// LES RECUERDO QUE ESTO ES LA CHULETA PARA HACER ALGO CON MYSQL DESDE PHP
// PRIMERO QUE NADA CONECTAR CON MYSQL
$conectar=mysql_connect('localhost','root','');
// SEGUNDO SELECCIONAR BASE DE DATOS
mysql_select_db('escuela',$conectar);
// TERCERO CONSTRUIR LA CONSULTA
$fecha=$this->a.'-'.$this->mes.'-'.$this->dia;
$sql="INSERT INTO asistencia VALUES( '$fecha',
'$this->hora',
'$this->nombre')";
// CUARTO EJECUTAR LA CONSULTA
$resultado=mysql_query($sql,$conectar);
//echo "error: $sql".mysql_error();

}
function getDia(){
return $this->dia;
}
function getMes(){
return $this->mes;
}
function getA(){
return $this->a;
}
function getHora(){
return $this->hora;
}
function getNombre(){
return $this->nombre;
}
}
?>

y del siguiente formulario: (que es donde ingreso los datos a la BD.)

<?
//INCLUIR ARCHIVOS REQUERIDOS
require_once('class/clsAsistencia.php');
// AHORA RESCATAR LAS VARIABLES DEL FORMULARIO
//CREAR UN OBJETO
$miAsistencia=new Asistencia($_REQUEST['cmbDia'],
$_REQUEST['cmbMes'],
$_REQUEST['txtA'],
$_REQUEST['txtHora'],
$_REQUEST['txtNombre']);

$cmdAccion=$_REQUEST['cmdAccion'];

// LOGICA DE LOS BOTONES
switch($cmdAccion){
case 'Agregar':
echo "SELECCIONO AGREGAR...";
$miAsistencia->agregar();
break;

case 'Salir':
?>
<script>
alert('!Hasta Luego¡');
window.location='MENU.html';
</script>
<?
break;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
<style>
label{
float: left;
text-align: right;
width: 30%;
}
</style>
</head>
<body bgcolor="#FCFFAC">
<h6><fieldset>
<strong>
<div id="header" align="center"><br>
<p>REPUBLICA BOLIVARIANA DE VENEZUELA<br />
MINISTERIO DE EDUCACION Y DEPORTES<br />
E.B.B. "ISIDRO RAMON MORENO"<br />
PALO NEGRO - ESTADO ARAGUA</p>
</div>
</strong>

<div align="center">
</div>

<form action="<? echo $PHP_SELF; ?>" name="frmAsistencia" method="post">
<strong>
<legend align="center"><strong>PLANILLA DE OBSERVACIONES DEL ALUMNO:</strong></legend>
<div align="right">
<label></label><br />
</div><br />
<label></label><br />
<label>FECHA:</label>
<select name="cmbDia" size="1">
<option value="0">DD</option>
<?
for($d=1;$d<=31;$d++){
// SELECCIONADO
$seleccionado='';
if($miAsistencia->getDia()==$d){
$seleccionado='selected';
}
echo "<option value=\"$d\" $seleccionado>$d</option>";
//echo "<option value=\"$d\">$d</option>";
}
?>
</select>/
<select name="cmbMes" size="1">
<option value="0">MM</option>
<?
for($m=1;$m<=12;$m++){
// SELECCIONADO
$seleccionado='';
if($miAsistencia->getMes()==$m){
$seleccionado='selected';
}
echo "<option value=\"$m\" $seleccionado>$m</option>";
//echo "<option value=\"$m\">$m</option>";
}
?>
</select>/
<input type="text" name="txtA" value="<? echo ($miAsistencia->getA()); ?>" size="4" maxlength="4" /><br />
<label>HORA:</label>
<input type="text" name="txtHora" value= "<? echo date("H:i"),$miAsistencia->getHora() ?>" size="8" maxlength="8" /><br />
<label>NOMBRE Y APELLIDO:</label>
<input type="text" name="txtNombre" value= "<? echo $miAsistencia->getNombre() ?>" size="60" maxlength="60" />

</strong></h6>
<hr />
<div align="center">
<input type="submit" name="cmdAccion" value="Agregar" />
<input type="submit" name="cmdAccion" value="Salir" />
</div>

</fieldset>
</form>

</body>

</html>


Ok el listado me muestra perfectamente los registros de la tabla!! Me gustaria que me ayudaran a agregarle una rutina que haga que las celdas cambien de color si la persona llega despues de las 07:30 para saber si llego tarde que cambie de color tambien si se va antes de las 15:30. el cuadro de texto de la hora esta sincronizado con la hora del reloj!!! me imagino yo que seria algo como esto:


if($h>07:30 and <15:30){
$color="#0000FF";
}else{
$color="#00DEFF";
}

echo "<tr> \n";

echo "<td>".$row["fecha"]."</td> \n";

echo "<td>".$row["nombre"]."</td>\n";

echo "<td>".$row["hora"]."</td>\n";

echo "<td align=\"right\" bgcolor=\"$color\"></td>";

echo "</tr> \n";


si me pudieran decir donde colocar la rutina o si la rutina esta correcta!! para que me funcione bien el programa se los agradeceria enormemente!! Muchas gracias de ante mano!!
  #2 (permalink)  
Antiguo 21/01/2012, 22:30
 
Fecha de Ingreso: enero-2012
Ubicación: venezuela
Mensajes: 19
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: Control de Asistencia phpy mysql Ayuda!!!

oye amigo me seria de mucho interes contactarte seria eso posible??
[email protected]

Etiquetas: asistencia, control, mysql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:07.