Mostrar mensaje de que no hay registro en base de datos
Publicado por Fred (23 intervenciones) el 27/05/2019 16:03:13
Hola que tal.
Necesito mostrar un mensaje que diga "No se ha encontrado problema en esta unidad" una vez que el usuario realice una búsqueda y esta sea negativa, aquí el código que utilizo:
Muchas gracias por el apoyo.
Necesito mostrar un mensaje que diga "No se ha encontrado problema en esta unidad" una vez que el usuario realice una búsqueda y esta sea negativa, aquí el código que utilizo:
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="estilo.css" MEDIA=screen>
<link rel="shortcut icon" href="logo.ico" />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<title>Centro de Monitoreo CCTV</title>
</head>
<body>
<br>
<h1>FALLAS DE UNIDAD</h1>
<br>
<form method="POST" action="index">
<input type = "submit" name = "boton-principal" class = "boton-principal" value = "Página Principal"/>
</form>
<form method="POST" action="fallaunidad">
<input type = "submit" name = "boton-agregar" class = "boton-agregar" value = "Agregar Registro"/>
</form>
<form method="POST" action="excel_falla_unidad">
<input type = "submit" name = "export_excel" class = "excel" value = "Exportar a Excel"/>
</form>
<a href="altafallaunidad"><img src="update.png" alt="actualizar" width="42" height="42" class="btn-actualizar"></a>
<form action="altafallaunidad" method="post" class="form-buscador">
<input size = 50 type="text" name="txtFiltro" placeholder="Busca por: Zona, Uden, Tienda">
<input type="submit" name="btnFiltrar" value="Buscar" class="btnFiltrar">
</form>
<br>
<a href="fallas_solucionadas"><img src="correcto.png" alt="solucionado" width="42" height="42" class="btn-correcto"></a>
<table border = 0 class="table table-striped table-hover table-bordered">
<tr class="bg-danger">
<th><i class="fa fa-sort">ID</i></th>
<th><i class="fa fa-sort">FECHA DE FALLA</i></th>
<th><i class="fa fa-sort">ZONA</i></th>
<th><i class="fa fa-sort">UDEN</i></th>
<th><i class="fa fa-sort">NOMBRE DE UNIDAD</i></th>
<th><i class="fa fa-sort">DISPOSITIVO EN FALLA</i></th>
<th><i class="fa fa-sort">FALLA</i></th>
<th><i class="fa fa-sort">TÉCNICO</i></th>
<th><i class="fa fa-sort">FECHA DE SOLUCIÓN</i></th>
<th><i class="fa fa-sort">OBSERVACIONES</i></th>
<th><i class="fa fa-sort">ESTATUS</i></th>
<th colspan="2"><i class="fa fa-sort">OPERACIÓN</i></th>
</tr>
<?php
include 'cn.php';
$usuario = false;
if(isset($_POST['btnFiltrar'])){
$filtro = $_POST['txtFiltro'];
$query="SELECT * FROM fallasunidad WHERE id = '$filtro' or uden like '%$filtro%' or unidad like '%$filtro%' or zona like '%$filtro%' or estatus like '%$filtro%'";
}else{
$query="SELECT * FROM fallasunidad WHERE estatus=1";
}
$resultado=$conexion->query($query);
while($row=$resultado->fetch_assoc()){
?>
<tr>
<td> <?php
$rut = $row['id'];
echo $rut; ?></td>
<td><?php echo $row['fecha_falla']?></td>
<td><?php echo $row['zona']?></td>
<td><?php echo $row['uden']?></td>
<td><?php echo $row['unidad']?></td>
<td><?php echo $row['dispositivo']?></td>
<td><?php echo $row['falla']?></td>
<td><?php echo $row['tecnico']?></td>
<td><?php echo $row['fecha_solucion']?></td>
<td><?php echo $row['observaciones']?></td>
<td><?php
if($row['estatus'] == '1'){
echo '<span class="label label-danger">ACTIVA</span>';
}
if($row['estatus'] == '0'){
echo '<span class="label label-success">SOLUCIONADO</span>';
}
?>
</td>
<td><a href="modificarfallaunidad?id=<?php echo $row['id']; ?>"><input type = "submit" value = "Modificar" class ="modify"></a></td>
<td>
<button type="button" class ="del" onClick="window.location='borrar_fallas?rut=<?php echo $rut; ?>';">
Eliminar
</button>
</td>
</tr>
<?php
}
?>
</table>
</body>
</html>
Muchas gracias por el apoyo.
Valora esta pregunta


0