-
Notifications
You must be signed in to change notification settings - Fork 0
/
showscore.php
44 lines (34 loc) · 1.42 KB
/
showscore.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
<?php
include 'db.php';
include 'projnum.php';
echo "CLASS ZERO\n";
$class = 0;
$sql = "select * from ranking where project=$projnum and classnumber=$class order by points desc limit 10";
$rs = mysqli_query($cid, $sql);
while ($ranked = mysqli_fetch_array($rs, MYSQLI_ASSOC))
{
echo $ranked["points"] . " points for " . $ranked["authorname"] . " " . $ranked["title"] . " id " . $ranked["authorid"] . " entry " . $ranked["entry"] . "\n";
$id = $ranked["authorid"];
$sql = "select email from users where id=$id";
$rs2 = mysqli_query($cid, $sql);
$em = mysqli_fetch_array($rs2, MYSQLI_ASSOC);
echo "Email " . $em["email"] . "\n";
$ent = $ranked["entry"];
echo "insert into bonus (groupnum, entry, id) values (X, $ent, $id);\n";
}
echo "CLASS ONE\n";
$class = 1;
$sql = "select * from ranking where project=$projnum and classnumber=$class order by points desc limit 10";
$rs = mysqli_query($cid, $sql);
while ($ranked = mysqli_fetch_array($rs, MYSQLI_ASSOC))
{
echo $ranked["points"] . " points for " . $ranked["authorname"] . " " . $ranked["title"] . " id " . $ranked["authorid"] . " entry " . $ranked["entry"] . "\n";
$id = $ranked["authorid"];
$sql = "select email from users where id=$id";
$rs2 = mysqli_query($cid, $sql);
$em = mysqli_fetch_array($rs2, MYSQLI_ASSOC);
echo "Email " . $em["email"] . "\n";
$ent = $ranked["entry"];
echo "insert into bonus (groupnum, entry, id) values (X, $ent, $id);\n";
}
?>