-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_any_table.php
More file actions
35 lines (23 loc) · 1.07 KB
/
delete_any_table.php
File metadata and controls
35 lines (23 loc) · 1.07 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
<?php
include('db.php');
/*********************************************************************************************/
/********************************************************************************************
DELETE ANY TABLE
/*********************************************************************************************/
/*********************************************************************************************/
$tale_name = $_POST['table_name'];
$id = $_POST['data'];
$name = $_POST['name'];
$sql="select count(*) as numers from transaction where name_id = '$id' and name = '$name' and company_email = '$company_email'";
$new = $conn->query($sql);
while ($row = $new->fetch_assoc()) {
if($row['numers']=='0'){
$result="DELETE FROM `$tale_name` WHERE `id` = '$id' and company_email = '$company_email'";
$new = $conn->query($result) or die (mysqli_error());
echo "Deleted Successfully";
}else{
echo "Deletion cannot be processed because it has transactions";
}
}
/*********************************************************************************************/
?>