You are using mysql_query twice. Try this instead:
Also, are you certain that $catId contains a valid value to will be found? If not, $sql will be FALSE, which won't work with mysql_result().
Finally, what is $conid? That parameter will be ignored by mysql_query because there are no value placeholder in the query string. Also, passing $catId into the query string is security issue (sql injkection attack), you should use the mysql_real_escape_string() function - the see the example in the PHP docs: http://php.net/manual/en/function.mysql-query.php