-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing.php
38 lines (37 loc) · 1.42 KB
/
testing.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
<?php
include "test.php";
include "db/connection.php";
function GetTestingInfo($subjectName) {
//название теста, его номер. По нажатию кнопки - выход на сдачу этого теста
//по всем tests из базы посмотреть результат и печатать баллы.
echo "<div align=\"center\">";
echo "<h2> Ваши тесты: </h2>";
$q = mysql_query("select results.score, tests.name, tests.test_id from results, tests", $_SESSION["connect"]);
if ($q == null)
return;
while ($row = mysql_fetch_array($q, MYSQL_ASSOC)) {
echo "<h2>".$row["name"]." - ".$row["score"]."</h2>";
if ((int)$row["score"] <= 70) {
echo "<a href=\"index.php?tests=\"".$row["subject"]."&".$row["test_id"].">Пересдать</a>";
}
}
}
// Создать таблицы для предметов и доп.таблицы #предмет_test, где хранить тесты этого предмета
function StartTest($testName, $testNumber) {
echo "<div align=\"center\">";
echo "<h2> Тест: </h2>";
$q = mysql_query("SELECT* FROM ".$testName." WHERE test_id=".$testNumber, $_SESSION["connect"]);
if ($q == null)
return;
while ($row = mysql_fetch_array($q, MYSQL_ASSOC)) {
$a = array(
$row["ans1"],
$row["ans2"],
$row["ans3"],
$row["ans4"]
);
PrintResultToPage($row["question"], $a, $row["type"], $row["question_id"]);
}
echo "</div>";
}
?>