-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_user_from_db.php
32 lines (26 loc) · 1.2 KB
/
get_user_from_db.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
<?php
session_start();
include_once("./connection.php");
$search_user_box = $_POST["search_user_box"];
$sql = "SELECT * FROM `users` WHERE `name` LIKE '%".$search_user_box."%' OR `username` LIKE '%".$search_user_box."%'";
$result = mysqli_query($conn, $sql);
$output = "";
while ($row = mysqli_fetch_assoc($result)) {
if ($_SESSION["username"] !== $row["username"] && "" !== $row["username"] && "Sorry, no user found!" !== $row["name"]) {
if($row["isLoggedIn"] === "Active Now"){
$isLoggedIn = "<i id='active_status'class='fa-solid fa-circle fa-2xs'></i>";
}
else{
$isLoggedIn = "<i id='active_status'class='fa-regular fa-circle fa-2xs'></i>";
}
$output .= "<tbody>
<tr>
<td><a href='?incoming_user=".$row['username']."' onclick='loadMessages()'><img src='".$row['profile_pic']."' class='img-thumbnail' style='height: 70px; width:70px;'></a></td>
<td><a href='?incoming_user=".$row['username']."' onclick='loadMessages()'><p>" . $row["name"]. "<br><i>".$row["bio"]."</i></p></a></td>
<td>".$isLoggedIn."</td>
</tr>
</tbody>";
}
}
echo $output;
?>