Turn answer to zero, if null or empty

Yes, posting code can be a bit tricky a times

CREATE TABLE `topics` (
  `id` int(9) NOT NULL AUTO_INCREMENT
  ,  `name` varchar(128) CHARACTER SET utf8 NOT NULL
  ,  `closed` tinyint(1) NOT NULL
  ,  `author` int(9) NOT NULL
  ,  `parent` int(9) NOT NULL
  ,  PRIMARY KEY (`id`)
  ,  UNIQUE KEY `id` (`id`)
  ,  KEY `id_2` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

I don’t see a “topic count” field, so I’m guessing the problem is not so much with a query like

SELECT COUNT(id) AS topicCount FROM topics

but more of a problem with the code that deals with the returned result

(I’m a bit confused why there would be a need to have UTF-8 and Latin1)