0
$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 的新手,如果用户输入错误的用户名并且未激活,我需要有关如何显示错误的帮助。到目前为止,我得到了上面的代码。

4

1 回答 1

0

试试这个

  $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
    }
于 2013-03-17T14:27:33.047 回答