SQL PHP Error: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given : <p>I'm trying to get the number of rows that contain null or empty fields so that if this number of rows is more than or equal to one, the user is prompted with an alert that tells them to complete these record(s), however I'm getting the error mentioned in the title.</p>

<p>Code:</p>

<pre><code>function incompleteTechLog() {

include 'config.php';

// Connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn-&gt;connect_error) {
    die("Connection failed: " . $conn-&gt;connect_error);
} 

$sql = "SELECT * FROM tbl_flights WHERE pilot_initial_post IS NULL OR = '' AND is_deleted = '0'"; // program allows for soft deleting so this must be included in the query
$result = $conn-&gt;query($sql);
$rows = mysqli_num_rows($result);

if ($rows &gt;= 1) {
    echo "&lt;div class='alert alert-warning' role='alert'&gt;&lt;strong&gt;Minor Alert! &lt;/strong&gt;" . $rows . " tech log(s) are incomplete. Please check all aircraft tech logs.&lt;/div&gt;";
} else {
    $conn = null;
}

} 
</code></pre>

<p>Any help would be greatly appreciated.</p>
