According to the manual:
mysqli_fetch_row() returns an array of strings that corresponds to the fetched row or NULL if there are no more rows in result set.
You're checking for a BOOL response, so the script continues on. Use either != FALSE or !== NULL.
The code would either be:
while (($row = mysqli_fetch_row($result)) != FALSE) {
OR
while (($row = mysqli_fetch_row($result)) !== NULL) {