I am getting an error with a database on my server. On my local computer everything is fine. I have confirmed through my host that the data is on the server and that the query works but I keep getting this error message:
Fatal error: Call to a member function free() on boolean
My php code is successfully working on another table in the same database. I have tested the query on phpMyAdmin and it works with the data. But when I  test $result it still comes up false. I don't understand why. Here is my php code:
<?php
    // Connect to the database by creating a new mysqli object
    include "inc/DBconnect.php";
    // Run a query and put the result into a new variable named $result -- It's just a table of results
    $result = $mysql->query("
SELECT
    staffId,
    company,
    fName,
    lName,
    title,
    contact1,
    contact2,
    department,
    comments,
    lastEdit
FROM staff WHERE archive = 0 ORDER BY lName");
    // Loop through the result from 0 to the number of rows in the result, one row at a time. $i will contain
    // the current row number every pass through the loop ( you could do it backwards too but why? )
    for ($i = 0; $i < $result->num_rows; $i++) {
    // Move to row number $i in the result set.
    $result->data_seek($i);
    // Get all the columns for the current row as an associative array -- we named it $aRow
    $aRow = $result->fetch_assoc();
    $staffId = $aRow['staffId'];
        // Write a table row to the output containing information from the current database row.
        print "<p>";
        print "<staffName><a href='staffDetails.php?ID=$staffId'>" . $aRow['fName'] . " " . $aRow['lName'] . "</a>  (" . $aRow['staffId'] .  ")</staffName>";
        print "<title>" . $aRow['title'] . "</title>";
        print "<contact>" . $aRow['contact1'] . " | " . $aRow['contact2'] . "</contact>";
        print "<company>" . $aRow['company'] . "</company>";
        print "<department>" . $aRow['department'] . "</department>";
        print "</p>";
    }
    // Very important: Close your result set to free up the memory it's taking.
    $result->free()
    ?>
 
     
    