-
Notifications
You must be signed in to change notification settings - Fork 0
/
prueba.php
66 lines (49 loc) · 2.48 KB
/
prueba.php
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
<?php
$output = '';
$numFila=0;
$num=0;
$nombre = $_POST['buscarNombre'];
$nombre = preg_replace("#[^0-9a-z]i#", "", $nombre);
if(!empty($nombre)){
include 'config.php';
$query = "SELECT * FROM documentos WHERE (nombre LIKE '%$nombre%')";
$result = mysqli_query($conexion, $query);
$count = mysqli_num_rows($result);
if ($count == 0) {
$output = "No se encontraron resultados!";
} else {
$output .= '
<table class="table" id="table">
<thead class="table-dark">
<tr class="clickable-row">
<th>Nro. Inventario</th>
<th>Nombre</th>
<th>Formato</th>
<th>Año</th>
<th>Edición</th>
<th>Disponibilidad</th>
</tr>
</thead>';
while ($row = mysqli_fetch_array($result)) {
$output .=
'<tbody style="cursor:pointer">
<tr id='.$numFila++.' onclick="seleccionar(this, '.$numFila.')" data-toggle="modal" data-target="#eliminarMaterial" >
<td id=' . $num++ . '><b>' .$row["id_inventario"] . '</b></td>
<td id=' . $num++ . '><b>' . $row["nombre"] . '</b></td>
<td id=' . $num++ . '><b>' . $row["formato"] . '</b></td>
<td id=' . $num++ . '><b>' . $row["anio"] . '</b></td>
<td id=' . $num++ . '><b>' . $row["edicion"] . '</b></td>
<td id=' . $num++ . '><b>' . $row["disponible"] . '</b></td>
</tr>
<tbody>'
;
}
$output .= '</table>';
}
}else{
echo '<script>';
echo 'alert("Rellene algun campo");';
echo '</scrip>';
}
echo $output;
?>