-
Notifications
You must be signed in to change notification settings - Fork 0
/
ownedgroups.php
53 lines (44 loc) · 1.8 KB
/
ownedgroups.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="groups.css">
<title>Groups</title>
</head>
<body>
<?php
include "navbar.php";
?>
<a class="sticky-top" href="creategroupform.php" type="button" id="create-group-button">Create Group </a>
<?php
//get the hiker id
$hiker_id=($_COOKIE["remember"]=="yes")?$_COOKIE["ID"]:$_SESSION["ID"];
//CONNECTING TO THE DATABASE
$db_conn=mysqli_connect("localhost","root","","hiking");
if(!$db_conn){ echo '<h5 style="color:red;margin-left:200px;">Couldn"t Connect To Database<br>';}
$result=$db_conn->query("SELECT * FROM hikinggroup,groupadmins WHERE hikinggroup.groupID=groupadmins.groupID AND groupadmins.administratorID='$hiker_id'");
$records_array=mysqli_fetch_all($result,MYSQLI_ASSOC);
for($i=0;$i<count($records_array);$i++){
$group_id=$records_array[$i]["groupID"];
$group_name=$records_array[$i]["name"];
$group_desc=$records_array[$i]["description"];
$group_image=$records_array[$i]["groupImage"];
$image_path="grouppictures/".$group_image;
echo '<div class="card w-100">
<div class="card-body">
<div id="group-img-div">
<img id="group-img" src="'.$image_path.'">
</div>
<div id="group-text-div">
<h5 style="margin-left:9%" class="card-title">'.$group_name.'</h5>
<p class="card-text">'.$group_desc.'</p>
<a id="group-button" href="groupprofile.php?groupid='.$group_id.'" class="btn btn-primary">Visit Group</a>
</div>
</div>
</div>';
echo "<br>";
}
?>
</body>
</html>