Realizar busqueda
Publicado por Eduardo (15 intervenciones) el 25/11/2019 17:24:27
Hola amigos.
Estoy intentando realizar un pequeño buscador, este es mi codigo, pero al ejecutarlo me manda el siguiente error. Espero que me puedan ayudar a corregirlo.
Fatal error: Uncaught Error: Call to a member function fetch_array() on boolean in C:\wamp\www\Inventario\muestra_empleados.php on line 64
Error: Call to a member function fetch_array() on boolean in C:\wamp\www\Inventario\muestra_empleados.php on line 64
Estoy intentando realizar un pequeño buscador, este es mi codigo, pero al ejecutarlo me manda el siguiente error. Espero que me puedan ayudar a corregirlo.
Fatal error: Uncaught Error: Call to a member function fetch_array() on boolean in C:\wamp\www\Inventario\muestra_empleados.php on line 64
Error: Call to a member function fetch_array() on boolean in C:\wamp\www\Inventario\muestra_empleados.php on line 64
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
<?php
require('conexion.php');
$where = "";
if(!empty($_POST))
{
$valor = $_POST['dato'];
if(!empty($valor)){
$where = "WHERE e.IDempleado LIKE '%$valor%";
}
}
$sql = "SELECT e.IDempleado, e.Nombre, e.Apaterno, e.Amaterno, em.NOMemp, d.NOMdepto, p.NOMpuesto, p.Jdepto, d.Darea, pl.NOMpta, e.Correo, e.Telefono FROM datos_empleados e
INNER JOIN empresa em ON e.Empresa = em.IDemp
INNER JOIN departamentos d ON e.Departamento = d.IDdepto
INNER JOIN puestos p ON e.Puesto = p.IDpuesto
INNER JOIN plantas pl ON e.Planta =pl.IDpta $where";
$resultado = $mysqli->query($sql);
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-theme.css" rel="stylesheet">
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<title>Tabla de empleados</title>
</head>
<body>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="text" name="dato" id="dato" autocomplete="off" maxlength="5">
<input type="submit" id="buscar" name="buscar" value="Buscar" class="btn btn-info">
<a href="reg_empleados.php" class="btn btn-primary">Nuevo Registro</a></br>
</form>
<h2 style="text-align:center">Catalogo de empleados</h2>
<div class="table-responsive">
<table class="table table-hover" style="font-size:10px" >
<tbody>
<tr>
<th>No. de Empleado</th>
<th>Nombre</th>
<th>Empresa</th>
<th>Departamento</th>
<th>Puesto</th>
<th>Jefe inmediato</th>
<th>Director de area</th>
<th>Planta</th>
<th>Correo electronico</th>
<th>Telefono</th>
</tr>
<?php while($mostrar = $resultado->fetch_array(MYSQLI_ASSOC)) { ?>
<td><?php echo $mostrar['IDempleado']?></td>
<td><?php echo $mostrar['Nombre'].' '.$mostrar['Apaterno'].' '.$mostrar['Amaterno']?></td>
<td><?php echo $mostrar['NOMemp']?></td>
<td><?php echo $mostrar['NOMdepto']?></td>
<td><?php echo $mostrar['NOMpuesto']?></td>
<td><?php echo $mostrar['Jdepto']?></td>
<td><?php echo $mostrar['Darea']?></td>
<td><?php echo $mostrar['NOMpta']?></td>
<td><?php echo $mostrar['Correo']?></td>
<td><?php echo $mostrar['Telefono']?></td>
<td><a href="mod_empleado.php?IDempleado=<?php echo $mostrar['IDempleado']; ?>"><button type="button" class="btn btn-success">Editar</button></a></td>
<td><a href="#" data-href="includes/eliminar_empleados.php?IDempleado=<?php echo $mostrar['IDempleado']; ?>" data-toggle="modal" data-target="#confirm-delete"><button type="button" class="btn btn-danger">Eliminar</button></a></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<!-- Modal -->
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Eliminar Registro</h4>
</div>
<div class="modal-body">
¿Desea eliminar este registro?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
<a class="btn btn-danger btn-ok">Eliminar</a>
</div>
</div>
</div>
</div>
<script>
$('#confirm-delete').on('show.bs.modal', function(e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
$('.debug-url').html('Delete URL: <strong>' + $(this).find('.btn-ok').attr('href') + '</strong>');
});
</script>
</body>
</html>
Valora esta pregunta


0