-
Notifications
You must be signed in to change notification settings - Fork 1
/
sfrB_sys.php
35 lines (26 loc) · 992 Bytes
/
sfrB_sys.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
<?php
session_start();
include 'dbh.php';
$year=mysqli_real_escape_string($conn,$_POST['year']);
$facultyId=mysqli_real_escape_string($conn,$_SESSION['id']);
$sql="SELECT id FROM submitted_for_review_table WHERE facultyId='$facultyId' AND year='$year'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)==0)
{
$sql1="INSERT INTO submitted_for_review_table (facultyId,year,partB) VALUES ('$facultyId','$year',1)";
$result1=mysqli_query($conn,$sql1);
}
else
{
$sql2="UPDATE submitted_for_review_table SET partB=1 WHERE facultyId='$facultyId' AND year='$year'";
$result2=mysqli_query($conn,$sql2);
}
//making entry into summary table
$sql="SELECT id FROM summary_table WHERE year='$year' AND facultyId='$facultyId'";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)==0)
{
$sqlx="INSERT INTO summary_table (year, facultyId) VALUES ('$year', '$facultyId')";
$resultx=mysqli_query($conn, $sqlx);
}
header("LOCATION: partB.php?id=".$facultyId."&year=".$year);