我正在尝试获取查询中的行数,但它一直给我这个错误
试图在第 15 行获取非对象的属性。
<?php require_once("./includes/Utilities.php") ;?>
<?php require_once("./includes/db_connection.php");?>
<?php
if(isset($_POST['submit'])){
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$conf_pass = trim($_POST['conf_password']);
$email = trim($_POST['email']);
require_once('./includes/CheckPassword.php');
$check_pwd = new Db_CheckPassword($password);
$check_pwd =$check_pwd->check();
require_once('./includes/CheckUsername.php');
$sql = "SELECT * FROM accounts WHERE username = {$username}";
$result = $conn->query($sql);
$numRows = $result->num_rows;
}
?>
这是第 15 行
$numRows = $result->num_rows;
为什么它返回错误?