-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmsg_content.php
54 lines (44 loc) · 1.67 KB
/
msg_content.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
<?php
session_start();
include 'db.php';
$msg_query = $db->query("SELECT distinct `user`,`user_to` from `message` where (`user_to` = '$username') order by `date` DESC");
$msg_row = $msg_query->fetchAll(PDO::FETCH_OBJ);
$count = $msg_query->rowCount();
for($i=0;$i<=$count-1;$i++)
{
$user = $msg_row[$i]->{"user"};
$user_to = $msg_row[$i]->{"user_to"};
$seen="0";
$count_query = $db->query("SELECT * from `message` where `user` = '$user' and `seen`='$seen'");
$count_row = $count_query->fetchAll(PDO::FETCH_OBJ);
$count_msg = $count_query->rowCount();
$user_query = $db->query("SELECT * from `users` where `username` = '$user'");
$user_row = $user_query->fetchAll(PDO::FETCH_OBJ);
$count_user = $user_query->rowCount();
$user_name = $user_row[0]->{"fname"}.' '.$user_row[0]->{"lname"};
echo '<div class="msg_feed" value="'.$user.'"><div class="user_image"></div>
<span>'.$user_name.'</span>
<a class="see_msg" href="message.php?user_to='.$user.'"><span class="badge_dark">'.$count_msg.'</span><span>
New Messages </span></a>
</div>';
// echo' <script>
// $(document).ready(function () {
// var msg = document.querySelector(".see_msg");
// msg.addEventListener("click",function()
// {
// var user_to = "'.$user_to.'";
// $.ajax({
// url: "msg_thread.php",
// type: "GET",
// data: "user_to="+user_to,
// cache:false,
// success: function(data) {
// $(".right.sect").html(data);
// // location.reload();
// }
// });
// });
// });
// </script>';
}
?>