-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatbox1.php
More file actions
33 lines (26 loc) · 992 Bytes
/
chatbox1.php
File metadata and controls
33 lines (26 loc) · 992 Bytes
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
<?php
$t=$_REQUEST["user"];
$link=mysqli_connect("localhost","root","");
mysqli_select_db($link,"chatapp");
$resu=mysqli_query($link,"SELECT * FROM msg_grp WHERE me LIKE '".$t."' OR username LIKE '".$t."' ORDER BY id DESC");
if(mysqli_num_rows($resu) != 0){
while($rowes=mysqli_fetch_array($resu)){
if($t == $rowes["me"]){
echo "<a href='msg.php?user=".$rowes["username"]."' style='text-decoration: none;'><div class='other'>".$rowes['username'];
$tablnm=$rowes['tablename'];
$res=mysqli_query($link,"SELECT * FROM $tablnm ORDER BY id DESC LIMIT 1");
while($rows=mysqli_fetch_array($res)){
echo "<div class='msg'>".$rows['msg']."</div></div></a>";
}
}
else{
echo "<a href='msg.php?user=".$rowes["me"]."' style='text-decoration: none;'><div class='other'>".$rowes['me'];
$tablnm=$rowes['tablename'];
$res=mysqli_query($link,"SELECT * FROM $tablnm ORDER BY id DESC LIMIT 1");
while($rows=mysqli_fetch_array($res)){
echo "<div class='msg'>".$rows['msg']."</div></div></a>";
}
}
}
}
?>