-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteuser.php
52 lines (39 loc) · 899 Bytes
/
deleteuser.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
<!DOCTYPE html>
<html>
<head>
<title>first</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
$id=$_POST["id"];
$un=$_POST["un"];
//$bday=$_POST["birthday"];
$servername="localhost";
$username="root";
$password="";
$db="toystoredb";
$con=mysqli_connect($servername,$username,$password,$db);
if(!$con)
{
die("connaction die".mysql_error());
}
echo "connection sucessfull<br>";
$sql = "select * from user where id='$id' AND username='$un' ";
$result = $con->query($sql);
if(!$result->num_rows) {echo "user already delete"."<br>"; header( "refresh:3;url=showuser.php" );}
else {
$sql2 = "DELETE FROM user WHERE id='$id' AND username='$un' ";
if ($con->query($sql2) === TRUE) {
echo "New delete successfully";
header( "refresh:3;url=showuser.php" );
} else {
echo "Error: " . $sql2 . "<br>" . $con->error;
}
}
mysqli_close($con);
}
?>
</body>
</html>