-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch-list.php
88 lines (78 loc) · 3.34 KB
/
search-list.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php session_start(); ?>
<?php
if(!isset($_SESSION['valid'])) {
header('Location: login.php');
}
?>
<?php
include_once("connection.php");
$search = $_GET["search"];
$search_selector = $_GET["search_selector"];
$result = mysqli_query($mysqli, "SELECT products.name AS productName , products.qty, products.price, users.name AS usersName , users.email, users.role FROM products INNER JOIN users ON products.users_id = users.id WHERE $search_selector LIKE '%$search%'");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Search | Gabriel Peña & Manuel Albarran</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-4">
<h2>Búsqueda de productos</h2>
</div>
<div class="col-sm-8">
<a href="logout.php" class="btn btn-danger">
<i class="material-icons">exit_to_app</i> <span>Salir</span>
</a>
<a href="index.php" class="btn btn-success">
<i class="material-icons">home</i> <span>Inicio</span>
</a>
<?php>include("search-component.php");?>
</div>
</div>
</div>
<table class="table table-striped table-hover actions">
<thead>
<tr>
<th id="name">Nombre del producto</th>
<th id="qty">Cantidad</th>
<th id="price">Precio</th>
<th id="user">Nombre del usuario</th>
<th id="email">Correo del usuario</th>
<th id="role">Rol</th>
</tr>
</thead>
<tbody>
<?php
while($res = mysqli_fetch_assoc($result)) {
?>
<tr>
<?php echo "<td>".$res['productName']."</td>"?>
<?php echo "<td>".$res['qty']."</td>"?>
<?php echo "<td>".$res['price']."</td>"?>
<?php echo "<td>".$res['usersName']."</td>"?>
<?php echo "<td>".$res['email']."</td>"?>
<?php echo "<td>".$res['role']."</td>"?>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>