这段代码工作在我的php myadmin上,但在我的实时数据库上没有“0结果”显示

gfttwv5a  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(169)

嗨,我从我的登录屏幕登录到我的报告这个代码在我的本地主机上工作,但不想在我的实时数据库上工作,有人能告诉我为什么要使用filezila吗

<?php

SESSION_start();

require_once '../config.php';

/* Logining in the users */
if(isset($_POST['Login']) && $_POST['Login'] == 1){
    //print_r($_POST);

    //Variables
    $email = $_POST['Email'];
    $password = $_POST['Password'];

    // check if there is a user with the same password

    $sql = "SELECT * FROM afm_user WHERE Email = '$email' AND Password = '$password'";
    $result = mysqli_query($conn, $sql);
    // print_r($email);

    //print_r($result);die();

    if ($result->num_rows > 0) {
        // output data of each row
        while($row = $result->fetch_assoc() ) {
            $_SESSION['userEmail'] = $row['Email'];
            $_SESSION['userId'] = $row['id'];
        }
        header("Location: ../index.php");
    } else {
        echo "0 results";
    }

}

嗨,我加了这个

if ($result->num_rows > 0) {
        // output data of each row
        while($row = $result->fetch_assoc() ) {
            $_SESSION['userEmail'] = $row['Email'];
            $_SESSION['userId'] = $row['id'];
        }
        header("Location: ../index.php");
    } else {
        echo("0 results" . mysqli_error($conn));
    }

}

如果有人能解释为什么它在myadmin而不是filezila上工作,那么显示的只是“0个结果”

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题