-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete-application.php
More file actions
44 lines (33 loc) · 1.01 KB
/
delete-application.php
File metadata and controls
44 lines (33 loc) · 1.01 KB
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
<?php
session_start();
$productid = $_POST['productid'];
if (empty($_POST['productid']) || empty($_COOKIE['email'])) {
header('location:home.php');
} else {
$email = $_COOKIE['email'];
$servername = "localhost";
$username = "root";
$password = "PASSWORD";
$dbname = "fullcashback";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully" . "<br>";
$s = "SELECT * FROM applications WHERE productid = '$productid' && useremail = '$email'";
$result = mysqli_query($conn, $s);
if (mysqli_num_rows($result) > 0) {
$sql = "DELETE FROM applications WHERE productid='$productid' && useremail = '$email'";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully" . "<br>";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
//Close the connection
mysqli_close($conn);
header('location:applications.php');
}
?>