I would suggest you stick to proper Joomla coding standards for your database query. You can always refer to the Joomla documentation to double check if you've done something properly or not.
Have a try of the following:
$db = JFactory::getDbo(); // Initiate database connection
$user = JFactory::getUser(); // Get user object
$query = $db->getQuery(true);
$query->select($db->quoteName('topic_id'))
->from($db->quoteName('#__kunena_user_topics'))
->where($db->quoteName('user_id') . ' = '. $db->quote($user->id));
$db->setQuery($query);
$results = $db->loadObjectList();
Now that you have an object of results, you can perform a loop and echo the results, like so:
foreach ($results as $result)
{
echo $result->topic_id . '<br>';
}
This will output something like the following:
26
12
5
89
Hope this helps