-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.php
More file actions
44 lines (30 loc) · 1.17 KB
/
class.php
File metadata and controls
44 lines (30 loc) · 1.17 KB
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
<?php
session_start();
require("logout.html");
$servername = "localhost";
$username = "root";
$password = "";
$dbName = "projectdb";
$class = $_GET['class'];
$conn = new mysqli($servername, $username, $password, $dbName);
$request = "select `name` from `classes` where `id` = ".$class;
#echo $request;
#echo $_SESSION['user'];
$className = $conn->query($request)->fetch_assoc()['name'];
$request = "select `projects` from `classes` where `id` = ".$class;
$projects = json_decode($conn->query($request)->fetch_assoc()['projects']);
$userType = $conn->query("select type from users where id = ".$_SESSION['user'])->fetch_assoc()['type'];
$by = "";
echo '<h1>'.$className.'</h1><br>';
echo '<br>Projects:<br><br><form action = "project.php" method="get">';
foreach($projects as $projectID){
$project = $conn->query("select `name`,`id` from `projects` where `id` = ".$projectID);
if($project->num_rows > 0){
$project = $project->fetch_assoc();
echo '<button type="submit" name="project" value ="'.$project['id'].'">'.$project['name'].'</button><br>';
}
}
echo "</form>";
require("submitproject.html");
$conn->close();
?>