-
Notifications
You must be signed in to change notification settings - Fork 6
/
fetch.php
63 lines (60 loc) · 1.17 KB
/
fetch.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
<?php
$connect = mysqli_connect("localhost", "root", "", "project");
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($connect, $_POST["query"]);
$query = "
SELECT * FROM symbols
WHERE title LIKE '%".$search."%'
";
}
else
{
$query = "
SELECT * FROM symbols ORDER BY id
";
}
$result=$connect->query($query);
if($result->num_rows > 0)
{
$output .= '
<div class="table-responsive table col-12">
<table class="table table bordered table-hover">
<thead>
<tr class="table-primary">
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Title</th>
<th>Year</th>
<th>Gender</th>
<th>From date</th>
<th>To Date</th>
<th>People</th>
</tr>
</thead>
';
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'.$row["id"].'</td>
<td>'.$row["name"].'</td>
<td>'.$row["email"].'</td>
<td>'.$row["title"].'</td>
<td>'.$row["year"].'</td>
<td>'.$row["gender"].'</td>
<td>'.$row["fromdate"].'</td>
<td>'.$row["todate"].'</td>
<td>'.$row["people"].'</td>
</tr>
';
}
echo $output;
}
else
{
echo '<h3 style="padding:30px;">Data Not Found</h3>';
}
?>