-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetchDataFromSearching.php
More file actions
51 lines (46 loc) · 924 Bytes
/
fetchDataFromSearching.php
File metadata and controls
51 lines (46 loc) · 924 Bytes
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
include "connect.php";
$output = '';
if(isset($_POST["input"])){
$input=$_POST["input"];
$query = "
SELECT * FROM docs
WHERE fname LIKE '".$input."%'
OR lname LIKE '".$input."%'
OR loc LIKE '".$input."%'
OR exp LIKE '".$input."%'
";
}
else{
$query = "
SELECT * FROM docs ORDER BY lname
";
}
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result) > 0){
$output .= '
<div class="table-responsive">
<table class="table table bordered">
<tr>
<th>Όνομα</th>
<th>Επίθετο</th>
<th>Ειδικότητα</th>
<th>Περιοχή</th>
</tr>
';
while($row = mysqli_fetch_array($result)){
$output .= '
<tr>
<td>'.$row["fname"].'</td>
<td>'.$row["lname"].'</td>
<td>'.$row["exp"].'</td>
<td>'.$row["loc"].'</td>
</tr>
';
}
echo $output;
}
else{
echo '<span class="text-danger">Δεν βρέθηκε</span>';
}
?>