-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteusercode.php
34 lines (29 loc) · 931 Bytes
/
deleteusercode.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
<?php
$host="localhost";
$username="root";
$password="";
$dbname="iq_analyser";
$conn = new mysqli($host, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if (isset($_POST['userid'])) {
$uid = $_POST['userid'];
}
if (isset($_POST['username'])) {
$uname = $_POST['username'];
}
$query="select user_id from user where user_id='$uid' and user_name='$uname' ; ";
$result = mysqli_query($conn,$query);
if (($result) != null){
$sql="DELETE FROM login_credentials WHERE user_id = '$uid' ;";
$sql1="DELETE from registration_details where user_id='$uid' ;";
$sql2="DELETE from user where user_id='$uid' ;";
}
if ($conn->query($sql) === TRUE and $conn->query($sql2) === TRUE and $conn->query($sql1) === TRUE) {
echo "User details deleted successfully";
} else {
echo "didnt meet the credentials required(userid or username doesnot exist)";
}
mysqli_close($conn);
?>