-
Notifications
You must be signed in to change notification settings - Fork 3
/
fetch.php
31 lines (30 loc) · 825 Bytes
/
fetch.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
<?php
session_start();
include "connection.php";
$uname=$_SESSION['username'];
if (isset($_SESSION['to_name'])) {
$rname=$_SESSION['to_name'];
$q="select * from messenger where 1; ";
$res=mysqli_query($conn,$q);
while($row = mysqli_fetch_array($res))
{
if($row['from_name']==$uname && $row['to_name']==$rname)
{?>
<div class="sent">
<?php echo $row['message']; ?>
</div>
<?php
}
if($row['from_name']==$rname &&
$row['to_name']==$uname)
{?>
<div class="received">
<?php echo $row['message']; ?>
</div>
<?php
}
}
}
else
{echo "click on username to chat";}
?><br>