-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrop_tables.php
More file actions
38 lines (33 loc) · 777 Bytes
/
drop_tables.php
File metadata and controls
38 lines (33 loc) · 777 Bytes
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
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
// Connect database
include('connectdb.php');
// Array of tables to drop
$tables = [
'RATINGS',
'PURCHASES',
'RENTALS',
'ORDERS',
'FAVOURITES',
'CUSTOMER_USERNAME',
'CUSTOMER_EMAIL',
'CUSTOMER',
'MOVIEINFO',
'MOVIE'
];
foreach ($tables as $table) {
$dropSql = "DROP TABLE $table CASCADE CONSTRAINTS";
$stid = oci_parse($conn, $dropSql);
$result = oci_execute($stid);
if ($result) {
echo "Table $table dropped successfully!<br>";
} else {
$error = oci_error($stid);
echo "Error dropping $table: " . $error['message'] . "<br>";
header('Location: index.php');
}
oci_free_statement($stid);
}
oci_close($conn);
?>