我有错误 解析错误:语法错误,意外的“ else”(T_ELSE)
我为“无效代码”添加了另一个,以便如果“邀请代码”不在数据库中,则会回显“无效代码”消息。
这是我的代码:
if(isset($_POST['Register'])){
$inviteCode = ($_POST['inviteCode']);
if(!isset($_POST['inviteCode']) || $_POST['inviteCode'] == '') {
echo "Empty Invitation Code";
} else {
$rs_check = mysqli_query($conn, "SELECT `inviteCode`,`taken` from referrals WHERE inviteCode='$inviteCode' AND `taken` = '0'");
$num = mysqli_num_rows($rs_check);
if ($num <= 0) {
echo "Code is Already Used";
}
else{
$rs_check_update = mysqli_query($conn, "UPDATE referrals SET taken='1' WHERE inviteCode='$inviteCode'");
echo "Success";
}
else{
echo "Invalid Code"
}
}
}