skij
asked on
PHP/MySQL: Should I close the database connection before or after redirecting the browser?
Is there a difference? Is one of theses preferable? If I close the database connection before redirecting the header, I am worried that the process could seem slower. On the other hand, if redirect the browser before closing the database connection , I am worried that the database connection might not actually get closed!
<php
mysql_close($crm_db);
header('Location: ' . (!empty($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') .'/', true, 302);
exit;
?>
<?php
header('Location: ' . (!empty($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') .'/', true, 302);
mysql_close($crm_db);
exit;
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.