-
Notifications
You must be signed in to change notification settings - Fork 3
/
search.php
65 lines (43 loc) · 1.67 KB
/
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
55
56
57
58
59
60
61
62
63
64
65
<?php
session_start();
require_once("db.php");
$limit = 4;
if(isset($_GET["page"])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$start_from = ($page-1) * $limit;
if(isset($_GET['filter']) && $_GET['filter']=='searchBar') {
$search = $_GET['search'];
$sql = "SELECT * FROM users WHERE firstname LIKE '%$search%' LIMIT $start_from, $limit";
$sql = "SELECT * FROM users WHERE email LIKE '%$search%' LIMIT $start_from, $limit";
$sql = "SELECT * FROM users WHERE contactno LIKE '%$search%' LIMIT $start_from, $limit";
}
$result = $conn->query($sql);
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$sql1 = "SELECT * FROM users WHERE id_user='$row[id_user]'";
$result1 = $conn->query($sql1);
if($result1->num_rows > 0) {
while($row1 = $result1->fetch_assoc())
{
?>
<div class="attachment-block clearfix">
<img class="attachment-img" src="profilepic/<?php echo $row1['logo']; ?>" alt="Attachment Image">
<div class="attachment-pushed">
<h4 class="attachment-heading"><a href="view-profile.php?id=<?php echo $row['id_user']; ?>"><?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?></a> </h4>
<div class="attachment-text">
<div><strong><?php echo $row1['email']; ?> | <?php echo $row['contactno']; ?> </strong></div>
</div>
</div>
</div>
<?php
}
}
}
}
else {
echo "No matches";
}
$conn->close();