-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
107 lines (99 loc) · 2.71 KB
/
index.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
$servername = "";
$username = "";
$password = "";
$dbname = "";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<title>Svoboda Diaries Word Search</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12 col-lg-4"></div>
<div class="col-12 col-lg-4">
<center>
<h1>Svoboda Diaries</h1>
<h2>Word Search</h2>
</center>
<br>
<br>
<form class="form-inline" action="index.php" method="post">
<div class="row">
<div class="col-8">
<div class="form-group">
<input type="text" class="form-control" placeholder="word..." name="word">
</div>
</div>
<div class="col-4">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</div>
</form>
<br>
<div style="border: 5px solid black;">
<p class="my-2 mx-2">
<?php
$word = $_POST["word"];
$sql = "SELECT columnName FROM tableName WHERE columnName LIKE '$word' ORDER BY columnName ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo $row["columnName"] . "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</p>
</div>
<br>
</div>
<div class="col-12 col-lg-4">
<div style="border: 5px solid black;" class="my-2 py-2 px-2">
<p><center><strong>Example Searches</strong></center></p>
<table class="table table-borderless">
<tbody>
<tr>
<td>svo%</th>
<td>Finds any values that start with "svo"</td>
</tr>
<tr>
<td>%oda</th>
<td>Finds any values that end with "oda"</td>
</tr>
<tr>
<td>%obo%</th>
<td>Finds any values that have "obo" in any position</td>
</tr>
<tr>
<td>s%a</th>
<td>Finds any values that starts with "s" and ends with "a"</td>
</tr>
<tr>
<td>s_o%</td>
<td>Finds any values that has "s" at the first position and and "o" at the third position
<tr>
</tbody>
</table>
<strong>Please Note:</strong>
<p><strong>%</strong> : The percent sign represents zero, one, or multiple characters</p>
<p><strong>_</strong> : The underscore represents a single character</p>
</div>
<br>
<p style="text-align: center;"><a href="http://depts.washington.edu/svobodad/">Svoboda Diaries Project Website</a></p>
</div>
</div>
</div>
</body>
</html>