-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_med.php
47 lines (43 loc) · 1.49 KB
/
search_med.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
<?php
$title="Search";
$text = trim($_POST['text']);
require_once "./functions/database_functions.php";
$conn = db_connect();
$query = "SELECT * FROM medicines join used_for on medicines.used_for_id=used_for.used_for_id where med_serial like'%$text%' or med_manufacturer like '%$text%' or med_name like '%$text%' or used_for_name like '%$text%' ";
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result)==0){
echo '
<div class="alert alert-warning" role="alert">
Nothing Found...
</div>' . ' <div class="search_top" >
</div>';
}
else
{
$number=mysqli_num_rows($result);
echo '<div class="alert alert-success" role="success"> ';
echo $number;
echo ' Medicines Found</div>' . ' <div class="search_top" >
</div>';
}
require_once "./template/header.php";
?>
<p class="lead text-center text-muted">Search Result</p>
<?php for($i = 0; $i < mysqli_num_rows($result); $i++)
{ ?>
<div class="row">
<?php while($query_row = mysqli_fetch_assoc($result))
{ ?>
<div class="col-md-3">
<a href="medicine.php?medserial=<?php echo $query_row['med_serial']; ?>">
<img class="img-responsive img-thumbnail" src="./bootstrap/img/<?php echo $query_row['med_image']; ?>">
</a>
</div>
<?php
} ?>
</div>
<?php
}
if(isset($conn)) { mysqli_close($conn); }
require_once "./template/footer.php";
?>