-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch1.php
58 lines (55 loc) · 1.08 KB
/
fetch1.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
<?php
//fetch.php
$connect = mysqli_connect("localhost", "root", "", "live");
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($connect, $_POST["query"]);
$query = "
SELECT * FROM generic_medicine
WHERE Name LIKE '%".$search."%'
OR Indications LIKE '%".$search."%'
OR Contraindications LIKE '%".$search."%'
OR Price LIKE '%".$search."%'
OR Side LIKE '%".$search."%'
";
}
else
{
$query = "
SELECT * FROM generic ORDER BY Name
";
}
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
$output .= '
<div class="table-responsive">
<table class="table table bordered">
<tr>
<th>Name</th>
<th>Indications</th>
<th>Contraindications</th>
<th>Price</th>
<th>Side</th>
</tr>
';
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'.$row["Name"].'</td>
<td>'.$row["Indications"].'</td>
<td>'.$row["Contraindications"].'</td>
<td>'.$row["Price"].'</td>
<td>'.$row["Side"].'</td>
</tr>
';
}
echo $output;
}
else
{
echo 'Data Not Found';
}
?>