I was wondering if there is a better way to write my code below. Basically two questions, should I use elseif and do I need to close the connection with the database somewhere?
Thank you
UPDATED CODE
if ($result && mysql_num_rows($result) === 1) {
$member = mysql_fetch_assoc($result);
if ($member['disabled']) {
header("location: not-allowed.php");
exit();
}
if (!$member['verified']) {
header("location: please-verify.php");
exit();
}
}
Do not repeat yourself
No, if you’re using
exitorreturnthere is no need for else.No, it’s unnecessary to close mysql connection manually.