PHP SQL Server返回BLANK页面

时间:2017-07-30 07:26:26

标签: php sqlsrv

登录页面在验证时返回BLANK页面,无论用户的凭据是否正确,我的猜测是我在解析$result->execute(array());实例时遇到问题。

<?php
session_start();

ini_set('display_errors', 1);
error_reporting(~0);

include 'connectlgn.php';

if(empty($_POST['uName']) OR empty($_POST['uPass'])){

    echo "Fill all the fields!";

    }else{

        $query = "SELECT * FROM dbo.wblgntst WHERE uname = :name AND upass = :pw";

        $result = $conn->prepare($query);

        $result->execute([':name' => $_POST['uName'], ':pw' => $_POST['uPass']]);

        while ($row = $result->fetch(PDO::FETCH_ASSOC)){

            if($row['uname'] === $_POST['uName'] AND $row['upass'] === $_POST['uPass']){

                header("Location: list.php");

                $uid = $row['uname'];

                $_SESSION['userID'] = 1;

                }else{

                    echo 'Authentication failed';
            }   

        }   

    }
?>

0 个答案:

没有答案