-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert.php
33 lines (28 loc) · 875 Bytes
/
insert.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
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "agri";
$pass=$_POST['password'];
$fname=$_POST['first'];
$lname=$_POST['last'];
$village=$_POST['village'];
$district=$_POST['district'];
$state=$_POST['state'];
$pin=$_POST['pincode'];
$user=$_POST['username'];
$phno=$_POST['phone'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO users(username, password,firstname, lastname, village, district, state, pincode, phone) VALUES ('$user','$pass', '$fname', '$lname', '$village', '$district','$state','$pin','$phno')";
if ($conn->query($sql) === TRUE) {
header('Location: index.html');
} else {
echo "0 results".$user;
}
$conn->close();
?>