-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathsearchPerson.php
106 lines (83 loc) · 2.91 KB
/
searchPerson.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
session_start();
$_SESSION["tab"] = "Search Person";
if($_SESSION["login"] != 1)
echo '<h2 txtcolor="red">Authentication Error!!!</h2>';
else{
include_once('header.php');
$pid = $_POST['pid'];
$sql = "select * from Person where p_id = '$pid'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
$count = mysqli_num_rows($result);
if($count == 1){
$pname = $row['p_name'];
$gender = $row['p_gender'];
$phone = $row['p_phone'];
$dob = $row['p_dob'];
$blood_group = $row['p_blood_group'];
$address = $row['p_address'];
$med_issues = $row['p_med_issues'];
###########contents of div goes here###########
echo'<h2>' .$pname .'</h2><br><br>';
echo'Personal Id : '.$pid .'<br><br>';
echo'Name : '.$pname .'<br><br>';
echo 'Phone Number: ' .$phone .'<br><br>';
echo 'DOB : ' .$dob .'<br><br>';
echo 'Blood Group : ' .$blood_group .'<br><br>';
echo 'Gender : ';
if ($gender === 'm')
echo 'Male<br><br>';
if ($gender === 'f')
echo 'Female<br><br>';
if ($gender === 'o')
echo 'Others<br><br>';
echo 'Address : ' .$address .'<br><br>';
echo 'Medical Issues : ';
if ($med_issues === "")
echo 'None<br><br><br>';
echo'<h3>Donation History</h3><br>';
$sql = "select * from Donation where p_id = '$pid'";
$result = mysqli_query($con, $sql);
if ($result->num_rows > 0) {
echo "<table><tr><th>Date of Donation</th><th>Time of Donation</th><th>Units of blood</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["d_date"]. "</td><td>" . $row["d_time"]."</td><td>" .$row["d_quantity"] ."</td></tr>";
}
echo "</table> <br><br>";
}
else
echo "No donations Yet";
echo'<h3>Receiving History</h3><br>';
$sql = "select * from Receive where p_id = '$pid'";
$result = mysqli_query($con, $sql);
if ($result->num_rows > 0) {
echo "
<table>
<tr>
<th>Date of Receive</th>
<th>Time of Receive</th>
<th>Units of blood</th>
<th>Hospital</th>
</tr>";
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td>" . $row["r_date"]. "</td>
<td>" . $row["r_time"]."</td>
<td>" .$row["r_quantity"] ."</td>
<td>" .$row["r_hospital"] ."</td>
</tr>";
}
echo "</table> <br>";
}
else
echo "No Receives Yet";
}
else{
echo 'Person with pid: ' .$pid .' not found!
<br>Please provide a valid personal id';
}
include_once('footer.php');
}
?>