-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinsert_data.php
34 lines (29 loc) · 1.15 KB
/
insert_data.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
<?php
include 'dbcon.php';
if(isset($_POST['add_unis'])){
$id = $_POST['id'];
$uname = $_POST['uniName'];
$location = $_POST['location'];
$sem = $_POST['semester'];
$type = $_POST['type'];
$desc = $_POST['description'];
$tusion = $_POST['tuition_fee'];
$csystem = $_POST['credit_system'];
$esystem = $_POST['entrance_system'];
$query = "SELECT * FROM `unis` WHERE `id` = '$id'";
$cros_chk_uni_info = mysqli_query($connection, $query);
if(mysqli_num_rows($cros_chk_uni_info)>0){
header('location:admin_home.php?already_exist=University already exists');
}
else{
$query = "insert into `unis` (`id`, `uniName`, `location`, `semester`,`type`, `description`, `tuition_fee`, `credit_system`, `entrance_system`) values('$id', '$uname', '$location','$sem', '$type', '$desc', '$tusion', '$csystem', '$esystem')";
$result = mysqli_query($connection,$query);
if(!$result){
die("Query Failed".mysqli_error($connection));
}
else{
header('location:admin_home.php?insert_msg=Your data has been added successfully');
}
}
}
?>