PHP的连接问题试图获取非对象的属性

时间:2018-09-06 21:49:23

标签: php mysql

我无法理解代码中的问题。请帮助我

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST'){

    $mobile_no = $_POST['mobile_no'];
    $password = $_POST['password'];

    include("connect.php");

    $sql = ("SELECT * FROM login WHERE mobile_no =".$mobile_no." and password=".$password.";");

    $result = $conn->query($sql);
    if ($result->num_rows == 1) {
        $row = $result->fetch_object();
        session_start();
        $_SESSION['userAccessInfo'] = $mobile_no;
        echo"yes";
        //header('Location: index.php') ;
        exit();
    }else{
        echo"no";       
       // header('Location:./') ;
        exit();
    }  
}
?>

0 个答案:

没有答案