-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch.php
53 lines (51 loc) · 1.01 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
<?php
//fetch.php
$connect = mysqli_connect("localhost", "root", "", "generic_medico");
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($connect, $_POST["query"]);
$query = "
SELECT * FROM generic_medicines
WHERE Name LIKE '%".$search."%'
";
}
else
{
$query = "
SELECT * FROM generic_medicines 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>Side Effects</th>
<th>Details</th>
</tr>
';
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'.$row["Name"].'</td>
<td>'.$row["Indication"].'</td>
<td>'.$row["Contra_Indication"].'</td>
<td>'.$row["Side_Effect"].'</td>
<td><a href="info.php?GenericName='.$row["Name"].'">View More</a></td>
</tr>
';
}
echo $output;
}
else
{
echo 'Data Not Found';
}
?>