please also check the value of $result by echoing it
because for loop execution is based on this value
if the vaue of the $result variable is '0' then there is nothing to display
so please check & echo the value of $result variable also
happy coding