I have the following bit of code where I'm redirecting after an INSERT
to a MySQL database.
if ($connect->query($dragon_sql) === TRUE) {
echo "You've picked the dragon book!";
header('Location: index.php');
exit();
} else {
echo "Error: " . $sql . "<br>" . $connect->error;
}
$connect->close();
I've read on the manual page that exit
Terminates execution of the script. Shutdown functions and object destructors will always be executed even if exit is called.
So is close()
a shutdown function or object destructor? I can't really tell by reading the PHP manual page for it.
exit()
or die()
simply stops executing the rest of the script.
so it's not a desctructor.
it's more of a shutdown function
mysqli close()
function closes the connection to the database .. even though it's said to be useless because the connection is already closed by the end of the script.