forked from OvidiuRusu/TW
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddnota.php
More file actions
18 lines (18 loc) · 809 Bytes
/
addnota.php
File metadata and controls
18 lines (18 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
//inseram in baza de date o noua nota preluata dintr-un formular prin intermediul unui buton
session_start();
$username = $_SESSION['username'];
if(isset($_POST['nota'])){
include('connection.php');
$result = mysql_query("select profesor.IdProfesor as idprof from profesor join account on profesor.IdAccount=account.IdAccount where account.Username='$username';");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
$idprof=$line["idprof"];
$result = mysql_query("select max(idnota) as idnota from nota;");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
$idnota=$line["idnota"]+1;
$idsub=$_POST['idsub'];
$nota=(int)$_POST['nota'];
mysql_query("INSERT INTO nota VALUES ('$idnota','$idsub','$idprof','$nota')");
header("Location: profsubs.php?name=".$_SESSION['numemat']);
}
?>