Skip to content
Snippets Groups Projects
Commit aeeedccf authored by Suriya Ravichandran's avatar Suriya Ravichandran
Browse files

update user list

parent b917e4d8
No related branches found
No related tags found
No related merge requests found
<?php
while($row = mysqli_fetch_assoc($sql)){
$sql2 = "SELECT * FROM messages WHERE (incoming_msg_id = {$row['unique_id']}
OR outgoing_msg_id = {$row['unique_id']}) AND (outgoing_msg_id = {$outgoing_id}
OR outgoing_msg_id = {$outgoing_id}) ORDER BY msg_id DESC LIMIT 1";
$query2 = mysqli_query($conn, $sql2);
$row2 = mysqli_fetch_assoc($query2);
$you = "";
if ($row2 && isset($row2['outgoing_msg_id'])) {
$result = $row2['msg'];
// adding your text before msg if login id send msg
$you = ($outgoing_id == $row2['outgoing_msg_id']) ? "You: " : "";
} else {
$result = "No message available";
}
(strlen($result) > 28) ? $msg = substr($result, 0, 28).'...' : $msg = $result;
$output .= '<a href="chat.php?user_id='.$row['unique_id'].'">
<div class="content">
<img src="php/images/'. $row['img'] .'" alt="">
<div class="details">
<span>'. $row['fname']." ".$row['lname'] .'</span>
<p>this is a test message</p>
<p>'. $you . $msg .'</p>
</div>
</div>
<div class="status-dot"><i class="fa fa-circle"></i></div>
</a>';
}
?>
\ No newline at end of file
?>
<?php
session_start();
include_once "config.php";
$outgoing_id = $_SESSION['unique_id'];
$searchTerm = mysqli_real_escape_string($conn, $_POST['searchTerm']);
$output = "";
$sql = mysqli_query($conn, "SELECT * FROM users WHERE fname LIKE '%{$searchTerm}%' OR lname LIKE '%{$searchTerm}%'");
......
<?php
session_start();
include_once "config.php"; // Include the config file to establish a database connection
$outgoing_id = $_SESSION['unique_id'];
$sql = mysqli_query($conn, "SELECT * FROM users");
$output = " ";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment