Always check for
mysqli errors, especially during development because then you can get meaningful error messages:
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_errno) {
printf("Connect failed: %s\n", $con->connect_error);
exit();
}
if ($result = $conn->query($sql)) {
}
else {
printf("Query failed: %s\n", $conn->error);
}
A possible error source is in your query string which has an unexpected comma between
DeadLine
and
FROM
. Such syntax errors result in a boolean
FALSE
be returned by the
query()
function instead of a
mysqli_result
object. And the boolean type is not an object type and has therefore no properties like
num_rows
.
See also
PHP: mysqli::query - Manual[
^]-