falla en la consulta multitabla
Publicado por enrique grant (1 intervención) el 29/06/2021 18:13:45
Hola muchachos estoy tratando de generar una consulta multitabla pero al poner el numero de documento en el campo no pasa nada solo se refresca la pagina alguien sabe que puede ser? dejo el código
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<center><b><h2>BIENVENIDO CONSULTE SU HORARIO</h2></b></center>
<br>
<br>
<center>
<form method="POST" action="consulta2021.php">
<center>
<div class="form-group">
<label for="Documento">DOCUMENTO</label>
<input type="text" name="Documento" id="Documento" placeholder="Ingrese su Documento">
</div>
<br>
</center>
<br>
<br>
<center>
<input type="submit" value="Consultar Prestamo" class="boton" name="btn_consultar_Pres">
<br>
<input type="submit" value="Consultar Horario" class="boton" name="btn_consultar_Hor">
</center>
</form>
<html>
<head>
<title>CEET</title>
</head>
<?php
if (isset($_POST['btn_consultar_Pres'])) {
include("conexiondb.php");
$DOCUMENTO = $_POST['DOCUMENTO'];
$existe=0;
if ($DOCUMENTO == "") {
}
else{
$resultados = mysqli_query($conexion, "SELECT NOMBRES, APELLIDOS, NOM_ROL, NOM_PROGRAMA, NOM_ELEMENTO, FECHJA_ENTREGA, FECHA_DEVOLUCION FROM $tablafuncionarios AS Fun INNER JOIN $tablaroles AS Ro ON Fun.ID_ROL=Ro.ID_ROL INNER JOIN $tablaprograma_formacion AS Prog ON Fun.ID_PROGRAMA=Prog.ID_PROGRAMA INNER JOIN $tablaprestamos AS Prest ON Fun.DOCUMENTO=Prest.DOCUMENTO INNER JOIN $tablaelementos AS Elem ON Prest.ID_ELEMENTO=Elem.ID_ELEMENTO WHERE Fun.DOCUMENTO='$DOCUMENTO'");
while($consulta =mysqli_fetch_array($resultados,MYSQLI_ASSOC))
echo
"
<div class=caja>
<!DOCTYPE html>
<html>
<body>
<table border=3 width=100% bordercolor=black>
<CAPTION ALIGN=top><center><H2><b>RESULTADO DE LA CONSULTA</center></CAPTION>
<CAPTION ALIGN=bottom><center><H2>USUARIO REGISTRADO</CAPTION>
<tr>
<th bgcolor=gainsboro><b><h4><center>NOMBRE<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>APELLIDO<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>NOMBRE ROL<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>PROGRAMA<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>ELEMENTO<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>FECHA ENTREGA<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>FECHA DEVOLUCION<h4></b></th>
</tr>
</thead>
<tr>
<td><h4><FONT COLOR=white><center>".$consulta['NOMBRE']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['APELLIDO']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['NOMBRE_ROL']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['NOMBRE_PROGRAMA']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['ELEMENTO']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['ENTREGA']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['FECHA_DEVOLUCION']."</FONT></center></td>
</tr>
</table>
</div>
";
{
$existe++;
}
if ($existe==0) {
echo "<script>alert('El numero de cedula No Existe');</script>";
}
if (isset($_POST['btn_consultar_Hor'])) {
include("conexiondb.php");
$DOCUMENTO = $_POST['DOCUMENTO'];
$existe=0;
if ($DOCUMENTO == "") {
}
else{
$resultados = mysqli_query($conexion, "SELECT FROM NOMBRES, APELLIDOS, NOM_ROL, NOM_PROGRAMA, JORNADA, DIAS_FORMACION, HORA_FORMACION FROM $tablafuncionarios AS Fun INNER JOIN $tablaroles AS Ro ON Fun.ID_ROL=Ro.ID_ROL INNER JOIN $tablaprograma_formacion AS Prog ON Fun.ID_PROGRAMA=Prog.ID_PROGRAMA INNER JOIN $tablajornadas AS Jorn ON Fun.JORNADA=Jorn.JORNADA WHERE Fun.DOCUMENTO='$DOCUMENTO'");
while($consulta =mysqli_fetch_array($resultados,MYSQLI_ASSOC))
echo
"
<!DOCTYPE html>
<html>
<body>
<table border=3 width=100% bordercolor=black>
<CAPTION ALIGN=top><center><H2><b>RESULTADO DE LA CONSULTA</center></CAPTION>
<CAPTION ALIGN=bottom><center><H2>USUARIO REGISTRADO</CAPTION>
<tr>
<th bgcolor=gainsboro><b><h4><center>NOMBRE<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>APELLIDO<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>NOMBRE ROL<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>PROGRAMA<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>JORNADA<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>DIAS FORMACION<h4></b></th>
<th bgcolor=gainsboro><b><h4><center>HORA FORMACION<h4></b></th>
</tr>
</thead>
<tr>
<td><h4><FONT COLOR=white><center>".$consulta['NOMBRE']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['APELLIDO']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['NOMBRE_ROL']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['NOMBRE_PROGRAMA']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['NOMBRE_JORNADA']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['DIAS_FORMACION']."</FONT></center></td>
<td><h4><FONT COLOR=white><center>".$consulta['HORA_FORMACION']."</FONT></center></td>
</tr>
</table>
</div>
";
{
$existe++;
}
if ($existe==0) {
echo "<script>alert('El numero de cedula No Existe');</script>";
}
}
}
}
}
?>
Valora esta pregunta


0