include "library/User.php";
$user = new User();
$senderId = $_REQUEST['senderId'];
$receiverId = $_REQUEST['receiverId'];
$con = mysqli_connect('localhost', 'root', '', 'newcolorschool');
$result1 = $con->query("SELECT * FROM logs WHERE (sender_id = $senderId AND receiver_id = $receiverId) OR ( sender_id = $receiverId AND receiver_id = $senderId) ORDER BY date DESC");
while ($extract = mysqli_fetch_array($result1)) {
$userNameData = $user->getUserById($extract['sender_id']);
echo "<span>" . $userNameData->name ."</span>: <span>" . $extract['msg'] . "</span><br />";
}