42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
|
require '../../conexion.php';
|
|
$salida = "";
|
|
$query = "SELECT * FROM cat_papel ORDER BY id_papel";
|
|
echo $_POST['consulta'];
|
|
echo "hola";
|
|
if(isset($_POST['consulta'])){
|
|
$q = $mysqli->real_escape_string($_POST['consulta']);
|
|
$query = "SELECT concepto, tipo, marca, existencia FROM cat_papel
|
|
WHERE concepto LIKE '%" .$q. "%' OR tipo LIKE '%" .$q. "%' OR marca LIKE '%" .$q. "%'";
|
|
}
|
|
$resultado = $mysqli->query($query);
|
|
|
|
if($resultado->num_rows > 0){
|
|
$salida.="<table class='table_datos'>
|
|
<thead>
|
|
<tr>
|
|
<td>Concepto</td>
|
|
<td>Tipo</td>
|
|
<td>Marca</td>
|
|
<td>Existencia</td>
|
|
</tr>
|
|
</thead>
|
|
</tbody>";
|
|
while($fila = $resultado->fetch_assoc()){
|
|
$salida.="<tr>
|
|
<td>".$fila['concepto']."</td>
|
|
<td>".$fila['tipo']."</td>
|
|
<td>".$fila['marca']."</td>
|
|
<td>".$fila['existencia']."</td>
|
|
<tr>";
|
|
}
|
|
|
|
$salida.="</tbody></table>";
|
|
|
|
}
|
|
else{
|
|
$salida.= "No hay datos que coincidan con tu busqueda";
|
|
}
|
|
echo $salida;
|
|
$mysqli->close();
|
|
?>
|