-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.php
65 lines (45 loc) · 1.32 KB
/
list.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
55
56
57
58
59
60
61
62
63
64
65
<?php
$connect = mysqli_connect(
'<DB_HOST>',
'<DB_USERNAME>',
'<DB_PASSWORD>',
'<DB_DATABASE>'
);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student list</title>
</head>
<body>
<h1>Student List</h1>
<?php
$query = 'SELECT *
FROM programs
ORDER BY name';
$programs = mysqli_query($connect, $query);
?>
<?php while($program = mysqli_fetch_assoc($programs)): ?>
<h2><?=$program['name']?></h2>
<?php
$query = 'SELECT *
FROM students
WHERE program_id = '.$program['id'].'
ORDER BY last,first';
$students = mysqli_query($connect, $query);
?>
<?php while($student = mysqli_fetch_assoc($students)): ?>
<h3><?=$student['first']?> <?=$student['last']?></h3>
<a href="<?=$student['portfolio']?>"><?=$student['portfolio']?></a>
<a href="https://www.linkedin.com/sharing/share-offsite/?url=<?=urlencode($student['portfolio'])?>">
Share on LinkedIn
</a>
<br>
<?php endwhile; ?>
<hr>
<?php endwhile; ?>
</body>
</html>