-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
23 lines (23 loc) · 803 Bytes
/
search.php
File metadata and controls
23 lines (23 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
$connect = mysqli_connect("localhost", "root", "", "dictionary");
if(isset($_POST["query"]))
{
$output = '';
$query = "SELECT * FROM `wn_synset` WHERE word='".$_POST["query"]."' OR word LIKE '%".$_POST["query"]."%' GROUP BY word LIMIT 25";
$result = mysqli_query($connect, $query);
$output = '<ul class="list-unstyled">';
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
$output .= '<li data-wid="'.$row["synset_id"].'" data-wnum="'.$row["w_num"].'">'.$row["word"].'</li>';
}
}
else
{
$output .= '<li>Word Not Found</li>';
}
$output .= '</ul>';
echo $output;
}
?>