We can't tell: we have no access to your connection string, your code, or to your database. At a guess,
$result
is not what you think it is!
So try looking at this:
PHP: mysqli_result::fetch_assoc - Manual[
^] and compare the whole code with what you have written but not shown us.