Declared $site_image within function scope.
Edited misuse of $row variable and replaced with $topic_data.
Found and corrected by andfel17.