I am trying to get the results of a MySQL table with the column name 'teachername' what's happening is, when I search the the name I am getting a error which states I am trying to get the property of a non-object.
Here is the code..
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";
}
The line the error is reffering to is
if ($result->num_rows > 0) {
Thank you!