-
Notifications
You must be signed in to change notification settings - Fork 3
/
admin_batch_manage.php
37 lines (19 loc) · 1.05 KB
/
admin_batch_manage.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
$mysqli = new mysqli('localhost','root','','greendale') or die(mysqli_error($mysqli));
if (isset($_POST['submit'])){
$batch_id = $_POST['batch_id'];
$batch_name = $_POST['batch_name'];
$batch_code = $_POST['batch_code'];
$course_id = $_POST['course_id'];
$assignment_id =$_POST['assignment_id'];
$mysqli->query("INSERT INTO module_assignments (assignmnt_id ,batch_id ) VALUES('$batch_id','$assignment_id')") or die($mysqli->error);
$mysqli->query("INSERT INTO student_batches ( batch_id, batch_name, batch_code, course_id, assignment_id )VALUES('$batch_id','$batch_name','$batch_code','$course_id' ,'$assignment_id')") or die($mysqli->error);
header("location:admin_batch.php");
}
$batch_id = $_POST['batch_id'];
if (isset($_GET['delete'])) {
$batch_id = $_GET['delete'];
$mysqli->query("DELETE FROM student_batches WHERE batch_id=$batch_id") or die ($mysqli->error());
$mysqli->query("DELETE FROM module_assignments WHERE batch_id=$batch_id") or die ($mysqli->error());
header("location:admin_batch.php");
}