-
Notifications
You must be signed in to change notification settings - Fork 0
/
adddoc.php
48 lines (45 loc) · 1.18 KB
/
adddoc.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
<?php
session_start();
$dbservername = 'localhost';//or localhost
$dbname = 'project'; // your db_name
$dbusername = 'root'; // root by default for localhost
$dbpassword = ''; // by defualt empty for localhost
//delete details
$reguser=$_POST["username"];
$regmob=$_POST["mob"];
$regemail=$_POST["email"];
$regpwd=$_POST["pass"];
$reglogin="doctor";
$cb="";
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
try
{
if (!($stmt = $conn->prepare("insert into users(username, password, login, email,mobile,createdby) VALUES (?,?,?,?,?,?)")))
{
echo "error preparing statement: ".$conn->error;
}
else if(!$stmt->bind_param("ssssss", $reguser, $regpwd, $reglogin,$regemail,$regmob,$cb))
{
echo "error binding params: ".$stmt->error;
}
else if(!$stmt->execute())
{
$_SESSION["docmsg"]="failed1";
header("location:admin.php");
}
else{
$_SESSION["docmsg"]="success";
header("location:admin.php");
}
$conn->close();
$stmt->close();
}
catch(Exception $e)
{
$_SESSION["docmsg"]="failed";
header("location:admin.php");
}
?>