-2

我有以下代码:

$query = "SELECT * FROM delegations where EMail='". $_REQUEST["user"] ."' AND Password = '". Encrypt($_REQUEST["pass"]) ."' ";
$results = mysqli_query($con, $query);

if(mysqli_num_rows($results) > 0) {

    while($row = mysqli_fetch_array($results)) {

        $_SESSION["login"] = $row["ID"];
        echo "Welcome <b>" . $row["FirstName"] . "</b>! You have logged in succesfully! <a href=\"index.php\">Click here</a> to continue!";

    }

当我在我的本地主机 xampp 上运行它时,它运行良好。但是,当我将其上传到我的网络服务器时,我收到以下错误代码:

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result,
boolean given in *path*/login.php on line 28

有什么建议么?

4

2 回答 2

0
$results = mysqli_query($con, $query) or die(mysqli_error( $con ));

我认为 $results 应该是错误的;使用mysqli_error您可以跟踪它。

否则检查

var_dump($results);
于 2013-07-25T12:48:33.697 回答
-1

mysqli_query失败了,请添加错误处理程序以显示错误。

$results = mysqli_query($con, $query) or die(mysqli_error($con));
于 2013-07-25T12:47:35.960 回答