Php 致命错误:调用未定义的方法mysqli_result::fetch()
当我尝试登录我的网站时,出现以下错误: (!)致命错误:在第10行的C:\wamp\www\Website\index2.php中调用未定义的方法mysqli_result::fetch() 这就是代码Php 致命错误:调用未定义的方法mysqli_result::fetch(),php,Php,当我尝试登录我的网站时,出现以下错误: (!)致命错误:在第10行的C:\wamp\www\Website\index2.php中调用未定义的方法mysqli_result::fetch() 这就是代码 <?php require 'Connections/Connections.php'; ?> <?php if(isset($_POST['Entrar'])){ $Email = $_POST['Email']; $Password =
<?php require 'Connections/Connections.php'; ?>
<?php
if(isset($_POST['Entrar'])){
$Email = $_POST['Email'];
$Password = $_POST['Password'];
$result = $con->query("SELECT * from user where Email='$Email' AND Password='$Password'");
$row = $result->fetch(MYSQLI_BOTH);
session_start();
$_SESSION["User ID"] = $row['UserID'];
hearder('Location: index.php');
}
?>
您可以通过放置var\u dump($result)来显示所显示的内容吗在使用$con->query(…)
之后立即使用code>?mysqli\u结果没有名为fetch
的方法。您需要列表中的某些内容(最有可能的情况是获取)。您的代码也容易受到sql注入的攻击。此外,不散列密码(例如使用)也被认为是不好的做法。再说一遍,…header
肯定是错误的。