-
Notifications
You must be signed in to change notification settings - Fork 0
/
getuser.php
55 lines (48 loc) · 970 Bytes
/
getuser.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
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 5px;
}
th {text-align: left;}
</style>
</head>
<body>
<?php
$q = $_GET['q'];
$servername = "localhost";
$username = "root";
$password = "SIpnz0Sjel";
// Create connection
$conn = mysqli_connect($servername, $username, $password, 'team018');
$sql="SELECT * FROM personnel WHERE name LIKE '%".$q."%'";
$res = mysqli_query($conn, $sql);
echo "<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Job Title</th>
<th>Department</th>
<th>Telephone Number</th>
</tr>";
if (mysqli_num_rows($res) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($res)) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['job'] . "</td>";
echo "<td>" . $row['dept'] . "</td>";
echo "<td>" . $row['telno'] . "</td>";
echo "</tr>";
}
}
echo "</table>";
?>
</body>
</html>