$username = mysqli_real_escape_string($_POST['username']);
$result = mysqli_query($connect, "SELECT * FROM account WHERE username='".$username."' AND activate='0'");
while($row = mysqli_fetch_assoc($result)) {
echo 'Account not activated.';
}
我是MYSQLi的新手,如果用户输入错误的用户名并且未激活,我需要帮助我如何显示错误。到目前为止,我得到了上面的代码。
答案 0 :(得分:1)
试试这个
$username = mysqli_real_escape_string($_POST['username']);
$result = mysqli_query($connect, "SELECT * FROM account WHERE username='".$username."' AND activate='0'");
if ($result->num_rows) {
echo "you are activated !!";
}
else
{
// do what u like here if not activated
}