-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroupToChatCall.php
54 lines (45 loc) · 1.69 KB
/
groupToChatCall.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
$servername = "localhost";
$username = "root";
$password = "";
$databaseName = "chatroom";
$conn = new mysqli($servername,$username,$password,$databaseName);
echo "<h3>Groups</h3>";
if ($conn)
{
$sql = "SELECT * FROM `groups`";
$result = $conn->query($sql);
if($result->num_rows > 0 )
{
//output data of each row
while($row = $result->fetch_assoc())
{
$group_name = $row["name"];
$group_desc = $row["description"];
$group_admin = $row["creator"];
$group_id = $row["id"];
$group_image = $row["img"];
echo "
<div id = 'groupList'
<div id = 'imgIcon'>
<a href = 'groupDiscussion.php?userId=$group_id '
style = 'text-decoration:none;color:black;'>
<img src='$group_image' alt='icon'
style = 'width:30px;height:35px;border-radius:50%;
float:left;margin:1px 10px 4px 4px;'>
</a>
<strong ><a href = 'groupDiscussion.php?userId=$group_id '
style = 'text-decoration:none;color:black;'>$group_name</a>
</strong>
<p style = 'font-size:10px;'>$group_desc</p>
</div>
<center> <hr style ='width:100%'></center>
";
}
}
}
else
{
echo "Unable to connect to database";
}
?>