0
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);

if(isset($username)){

    $queryIsUsername = ("SELECT count(user) FROM users WHERE user = '$username'");
    $actionQueryIsUsername = mysql_query($queryIsUsername);
    while($rowIsUsername = mysql_fetch_array($actionQueryIsUsername)) {
        $isUsername[] = $rowIsUsername['COUNT(user)'];
    }

    if($isUsername[0]="0"){

        header("Location: login.php?error=e1");
    }

我检查了 MySQL 数据库,它是在线的。我检查了它确实有效的查询。我不知道发生了什么,我已经做了很多。错误如下。

警告:mysql_fetch_array() 期望参数 1 是资源,布尔值在第 12 行的 /Applications/XAMPP/xamppfiles/htdocs/craftlist/index.php 中给出

4

2 回答 2

0

确保

  • 您正在选择数据库
  • 您正在选择正确的列名
  • 您在需要的地方有单引号。
于 2013-05-09T01:52:40.790 回答
0

当您遇到这样的错误时:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/craftlist/index.php on line 12

那么这意味着您的 mysql_query 中有错误。要查看真正的错误是什么:

mysql_query() or die(mysql_error());
于 2013-05-09T02:05:19.473 回答