-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcase_search.php
54 lines (48 loc) · 1.32 KB
/
case_search.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
<?php
function fetch_case_data ($conn, $caseid)
{
$query = "SELECT *
FROM Registration inner join Victim on Registration.Aadhar_Number = Victim.Aadhar_Number
WHERE Registration.Case_Id= ".$caseid ." ";
// if ($caseid !== "")
// {
// $query = $query . "AND (registration.Case_id= ".$caseid.")";
// echo $query ;
// }
// if ($last_name !== "")
// {
// $query = $query . "AND (employees.last_name = '$last_name')";
// }
// if ($dept_name !== "")
// {
// $query = $query . "AND (departments.dept_name = '$dept_name')";
// }
// else
// {
// die("No data provided");
// }
// echo $query ;
// Get employee details
$result = mysqli_query($conn, $query)
or die("Failed to query in database: " . mysqli_error($conn));
$fields_num = mysqli_num_fields($result);
echo "<h1>Table: Case Details </h1>";
echo "<table border='1'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysqli_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// printing table rows
while($row = mysqli_fetch_row($result))
{
echo "<tr>";
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysqli_free_result($result);
}
?>