-
Notifications
You must be signed in to change notification settings - Fork 0
/
userinfo.php
68 lines (55 loc) · 1.83 KB
/
userinfo.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
$server = "localhost";
$username = "id13909060_s";
$password = "YOUR_DB_PASSWORD";
$database = "id13909060_m";
$con = mysqli_connect($server,$username,$password,$database);
if($con){
// echo "Connection successful";
}
else{
echo "No connection";
}
// echo "Success connecting to the db";
mysqli_select_db($con,'id13909060_m');
if(isset($_POST['user'])){
$user = $_POST['user'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$comments = $_POST['comments'];
$sql = "INSERT INTO `andaman` (`user`, `email`, `mobile`, `comment`) VALUES
('$user', '$email', '$mobile', '$comments');" ;
// INSERT INTO `userinfodata` (`id`, `user`, `email`, `mobile`, `comment`) VALUES ('1', 'Mehuli', '[email protected]', '9876543210', 'Hello');
// echo $sql;
/*
if($con->query($sql) == true){
// echo "Successfully inserted";
$insert = true;
}
else{
echo "ERROR: $sql <br> $con->error";
}
$con->close(); */
//mysqli_query($con,$sql);
// header('location:index.php');
//$response=array();
if ($con->query($sql)) {
// $json = array("status" => 202 , "msg" => "Your record inserted successfully");
$response["status"]="202";
$response["msg"]="Your record inserted successfully";
// echo json_encode(array('status' => '202', 'msg' => 'Your record inserted successfully'));
}
else {
//echo "Error: " . $sql . "<br>" . mysqli_error($con);
// $json = array("status" => 404 , "msg" => "Insertion unsuccessful");
$response["status"]="404";
$response["msg"]="Insertion unsuccessful";
//echo json_encode(array('status' => '404', 'msg' => 'Insertion unsuccessful'));
}
//$json = $msg;
// header('content-type: application/json');
echo json_encode($response);
}
@mysqli_close($con);
// header('location:index.php');
?>