MYSQLI语句错误显示不正确但正确

I am getting following error from PHP and MYSQL, but the SQL statement is correct, I grabbed it direct from PHPmyadmin, I have included a picture from PHPMYADMIN showing the table.

$sql = 'SELECT * FROM company';

if ($mysqli->query($sql) === TRUE) {
    $result = $mysqli->query($sql);
    if ($result->num_rows > 0) {
    (data from result's)
    }
} else {
   echo "Error: " . $sql . "<br>" . $mysqli->error;
   exit();
}

Result: (There is nothing from $mysqli->error;)

Error: SELECT * FROM company

Inserted 2 rows into the table, still getting same error.

2 rows

Removed the first if statement.

Now getting following error:

( ! ) Notice: Trying to get property of non-object in C:\xampp\htdocs\mkpenterprices\Research.php on line 248

Finally got the SQL to run but its not populating anything on the javascript section.

Simply do this

$sql = 'SELECT * FROM company';


$result = $mysqli->query($sql);

if(!$result){
    echo "Error: " . $sql . "<br>" . $mysqli->error;
   exit();

}

if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
        var_dump($row);
    }
}