-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch2.php
52 lines (51 loc) · 1.05 KB
/
fetch2.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
<?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 brand_medicines
WHERE GENERIC_CONTENTS LIKE '%".$search."%'
";
}
else
{
$query = "
SELECT * FROM brand_medicines ORDER BY GENERIC_CONTENTS
";
}
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
$output .= '
<div class="table-responsive">
<table class="table table bordered">
<tr>
<th>GENERIC CONTENTS</th>
<th>INTERNATIONAL BRAND</th>
<th>PACK SIZE</th>
<th>Price Exclusive of VAT</th>
<th>Price Inclusive of VAT</th>
</tr>
';
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'.$row["GENERIC_CONTENTS"].'</td>
<td>'.$row["INTERNATIONAL_BRAND_NAME"].'</td>
<td>'.$row["PACKSIZE"].'</td>
<td>'.$row["PRICE_excl_VAT"].'</td>
<td>'.$row["PRICE_incl_VAT"].'</td>
</tr>
';
}
echo $output;
}
else
{
echo 'Data Not Found';
}
?>