
mostrar datos segun la fecha
Publicado por mario (31 intervenciones) el 06/01/2016 05:54:14
necesito su ayuda, mi problema es el siguiente estoy elaborando un trabajo en php lo cual consiste en introducir el numero de empleado de un maestro, al momento de introducirlo me tiene que arrojar los datos de la clase (maestro, salon, materia, horario) que tiene el maestro dependiendo de la hora que sea. por ejemplo un maestro tiene clase de 2 pm a 3 pm , el maestro va a pedir un material a las 2 pm y me da su numero de empleo , y yo como administrador solo le pido el numero de empleado, al momento de introducirlo me arrojan los datos del maestro de la clase en la que estara, el salon, etc .
nota: el maestro tiene diferentes clases a distinta hora.
necesito un consejo de como hacerlo lo que tengo hasta el momento es imprimir los datos en un formulario segun el numero de maestro, pero no se me ocurre como imprimir solo datos segun la hora.
nota: el maestro tiene diferentes clases a distinta hora.
necesito un consejo de como hacerlo lo que tengo hasta el momento es imprimir los datos en un formulario segun el numero de maestro, pero no se me ocurre como imprimir solo datos segun la hora.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!doctype>
<html>
<head>
<meta charset="utf-8">
<title>Documento sin título</title>
</head>
<?php
/*date_default_timezone_set("America/Mexico_City");
$time = time();
$fix = $time-3600;
echo "<center> Fecha Y Hora"."<br/>";
$dias = array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sábado");
$meses = array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
echo $dias[date('w')]." ".date('d')." de ".$meses[date('n')-1]. " del ".date('Y')."<br>" ;
echo date('H:i:s',$fix);
echo "</center>";
$hola = date('H',$fix);*/
error_reporting (E_ALL ^ E_DEPRECATED);
$conexión = mysql_connect("localhost", "root", "");
if (!$conexión) {
echo "No pudo conectarse a la BD: " . mysql_error();
exit;
}
if (!mysql_select_db("uacj")) {
echo "No ha sido posible seleccionar la BD: " . mysql_error();
exit;
}
$var1="";
$var2="";
$var3="";
$var4="";
$var5="";
$var6="";
$var7="";
$var8="";
$var9="";
if (isset($_POST['submit'])){
$boton= $_POST['submit'];
$numero = utf8_decode($_POST['numero']);
$materia = utf8_decode($_POST['materia']);
if($boton == "ver")
{
$sql = "SELECT * FROM prestamo WHERE prestamo.numero = '$numero'";
$resultado = mysql_query($sql,$conexión);
while ($registro = mysql_fetch_array($resultado)){
$var1= $registro["id"];
$var2= $registro["numero"];
$var3= $registro[2];
$var4= $registro[3];
$var5= $registro[4];
$var6= $registro[5];
$var7= $registro[6];
$var8= $registro[7];
$var9= $registro[8];
}
}
}
?>
<body>
<form method="post">
<center>
</center>
<h2><em>Formulario de prestamo</em></h2>
<label for="nombre">Numero de maestro <span><em>(requerido)</em></span></label>
<input type="text" name="numero" id="numero" value=""/>
<input name="submit" type="submit" value="ver" /><br/><br/>
<label for="maestro">Maestro:<span></span></label>
<input type="text" name="maestro" id="maestro" value="<?php echo $var3 ?>" />
<label for="materia">Materia:<span></span></label>
<input type="text" name="materia" id="materia" value="<?php echo $var4 ?>" />
<label for="salon">Salon:<span></span></label>
<input type="text" name="salon" id="salon" value="<?php echo $var5 ?>" /><br/><br/>
<label for="horario">Horario:<span></span></label>
<input type="text" name="horario" id="horario" value="<?php echo $var6 ?>" />
<label for="horario2">y<span></span></label>
<input type="text" name="horario2" id="horario2" value="<?php echo $var7 ?>" /><br/><br/>
<label for="hora">Hora:<span></span></label>
<input type="text" name="hora1" id="hora1" value="<?php echo $var8 ?>" />
<label for="horario2">a<span></span></label>
<input type="text" name="hora2" id="hora2" value="<?php echo $var9 ?>" /><br/>
</form>
</body>
</html>
Valora esta pregunta


0