I'm trying to delete one or multiple tables at once in my mySQLi db if it contains a string variable. So for example lets say I have 5 tables in my db:
Table 1 - name: db_table1_hello
Table 2 - name: db_table2_world
Table 3 - name: db_table3_hello
Table 4 - name: db_table4_world
Table 5 - name: db_table5_hello
Now I have a variable called tableString
and has the value hello
, in theory it would then be used to drop table 1, 3, and 5.
Not really sure on the best way to go about doing this so I thought I'd post it and get an idea from someone with a little more experience then me.
Thanks in advance guys.
EDIT:
$sql = "";
if(mysqli_query($conn, $sql)){
header("Location: " . $_SERVER["HTTP_REFERER"]);
} else {
echo "Table deletion unsuccessfully<br> ";
}