-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert2.php
46 lines (45 loc) · 1.3 KB
/
insert2.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
36
37
38
39
40
41
42
43
44
45
46
<?php
session_start();
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$college=$_POST['college'];
$roll=$_POST['rollno'];
$email=$_POST['email'];
$password=$_POST['password1'];
$cpassword=$_POST['password2'];
$dob=$_POST['dob'];
$gender=$_POST['gender'];
$uid=$_POST['uid'];
include("connection.php");
$query="INSERT INTO `students`(`first_name`, `last_name`, `college`, `Roll_no.`, `email`, `password`, `birthday`, `gender`, `uid`) VALUES ('$fname','$lname','$college','$roll','$email','$password','$dob','$gender','$uid')";
$run=mysqli_query($con,$query);
if($run==TRUE)
{
$query1="SELECT * FROM `students` WHERE email='$email';";
$run1=mysqli_query($con,$query1);
$data=mysqli_fetch_assoc($run1);
$str=strval($data['id']);
$str="s".$fname."".$str;
$sql = "CREATE TABLE $str (
id INT(50) AUTO_INCREMENT PRIMARY KEY,
bookno INT(30) NOT NULL,
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)";
if ($con->query($sql) === TRUE) {
echo "Table MyGuests created successfully";
} else {
echo "Error creating table: " . $con->error;
}
?>
<script type="text/javascript">alert("Registered successfully");
window.location.href="index.php";</script>
<?php
}
else
{
?>
<script type="text/javascript">alert("Registration has failed.");
</script>
<?php
}
?>