-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmedPertype.php
51 lines (48 loc) · 1.26 KB
/
medPertype.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
<?php
session_start();
require_once "./functions/database_functions.php";
if(isset($_GET['typeid']))
{
$typeid = $_GET['typeid'];
}
else
{
echo "Wrong query! Check again!";
exit;
}
$conn = db_connect();
$typename = gettypeName($conn, $typeid);
$query = "SELECT med_serial, med_name, med_image FROM medicines WHERE type_id = '$typeid'";
$result = mysqli_query($conn, $query);
if(!$result)
{
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
if(mysqli_num_rows($result) == 0)
{
echo "Empty medicines ! Please wait until new Medicines coming!";
exit;
}
$title = "Medicines Per type";
require "./template/header.php";
?>
<p class="lead"><a href="type_list.php">Types</a> > <?php echo $typename; ?></p>
<?php while($row = mysqli_fetch_assoc($result))
{
?>
<div class="row">
<div class="col-md-3">
<img class="img-responsive img-thumbnail" src="./bootstrap/img/<?php echo $row['med_image'];?>">
</div>
<div class="col-md-7">
<h4><?php echo $row['med_name'];?></h4>
<a href="medicine.php?medserial=<?php echo $row['med_serial'];?>" class="btn btn-primary">Get Details</a>
</div>
</div>
<br>
<?php
}
if(isset($conn)) { mysqli_close($conn);}
require "./template/footer.php";
?>