- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
if (isset ( $_POST ['atest'] ) && isset ( $_POST ['date_atest'] $_POST ['student'] ) && isset ( $_POST ['point'] ) ) {
( int ) $stud_id = $_POST ['student'];
( int ) $point = $_POST ['point'];
if (strlen ( $_POST ['atest'] ) > 3 && strlen ( $_POST ['date_atest'] ) == 10) {
$sql = "insert into `subjects` (`name`,`date`,`courses`,`group`)";
$sql .= "values (" . $db->qstr ( $_POST ['atest'] ) . "," . $db->qstr ( $_POST ['date_atest'] ) . "," . $course_input . "," . $group_input . ")";
$calc_attestation = "SELECT `users`.`id`, avg (`points`.`point`) attestation FROM `users`, `points`";
$calc_attestation .= "WHERE `users`.`id` = " . $stud_id . " AND `users`.`id` = `points`.`student`";
$result_calc_attestation = mysql_fetch_assoc(mysql_query($calc_attestation));
if ($result_calc_attestation['attestation'] >= 0 && $result_calc_attestation['attestation'] <= 0,5) {
$result_calc_attestation = 0;
$add_attestation = "insert into `points` (`point`, `course`, `student`)";
$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
}
if ($result_calc_attestation['attestation'] >= 0,5 && $result_calc_attestation['attestation'] <= 1) {
$result_calc_attestation = 1;
$add_attestation = "insert into `points` (`point`, `course`, `student`)";
$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
}
if ($result_calc_attestation['attestation'] >= 1 && $result_calc_attestation['attestation'] <= 1,5) {
$result_calc_attestation = 1;
$add_attestation = "insert into `points` (`point`, `course`, `student`)";
$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
}
if ($result_calc_attestation['attestation'] >= 1,5 && $result_calc_attestation['attestation'] <= 2) {
$result_calc_attestation = 2;
$add_attestation = "insert into `points` (`point`, `course`, `student`)";
$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
}
if ($result_calc_attestation['attestation'] >= 2 && $result_calc_attestation['attestation'] <= 2,5) {
$result_calc_attestation = 2;
$add_attestation = "insert into `points` (`point`, `course`, `student`)";
$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
}
[Код сокращен]
if ($result_calc_attestation['attestation'] >= 11,5 && $result_calc_attestation['attestation'] <= 12) {
$result_calc_attestation = 12;
$add_attestation = "insert into `points` (`point`, `course`, `student`)";
$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
}
if ($result_calc_attestation['attestation'] == 12) {
$result_calc_attestation = 12;
$add_attestation = "insert into `points` (`point`, `course`, `student`)";
$add_attestation .= "values (" . $result_calc_attestation . ", " . $course_input . ", " . $group_input;
}
if ($db->Execute ( $sql ) or $db->Execute ( $add_attestation ) === false) {
die ( 'Опаньки: ' . $db->ErrorMsg () );
}
$GLOBALS ['inform'] [] = "Атестація проведена";
} else {
$GLOBALS ['error'] [] = "Помилка додавання пари через те, що довжина назви менше 3-х символів або дата вказана не вірно.";
}
}
Ну и как это использовать? Я уже представил что будет если будет болонская система)