我正在尝试使用列名'Teachername'获取MySQL表的结果发生了什么,当我搜索名称时,我收到一个错误,指出我试图获取非对象的属性
这是代码..
if (isset($_GET['teacher'])) {
$teachername = $_GET['teacher'];
$sql = "SELECT * FROM assignmenthandout WHERE teachername = $teachername";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = mysqli_fetch_array ($result)) {
echo $row["assignmentname"]."<br />";
}
} else {
echo "There are no assignments due";
}
错误所在的行是
if ($result->num_rows > 0) {
谢谢!