-
Notifications
You must be signed in to change notification settings - Fork 1
/
loadchat.php
32 lines (29 loc) · 849 Bytes
/
loadchat.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();
$pid = $_GET['pid'];
include("database.php");
//Get the chat
$qry = "SELECT * FROM users u,projectchat2 c WHERE c.pid='$pid' and u.userid=c.userid order by time";
// $qry = "SELECT u.userid,u.name,c.message FROM users u,projectchat c WHERE c.pid='$pid' and u.userid=c.userid order by time";
$chat = mysqli_query ($db, $qry);
while ($showchat = mysqli_fetch_assoc($chat))
{
if ($_SESSION['userid']!=$showchat['userid'])
{
?>
<div class="otherchat">
<div class="otherchat_head"><?php echo $showchat['name']; ?></div>
<p><?php echo $showchat['message']; ?></p>
</div>
<?php
}
else
{ ?>
<div class="mychat">
<div class="mychat_head">You</div>
<p my><?php echo $showchat['message']; ?></p>
</div>
<?php
}
}
?>