Yea, that's what I'm talking aobut: the program that spits out that line of code gets it data from somewhere in order to produce the result. Before it produces the result (a la prints the link above on the page) see how many links it intends to print. If its only one, have it do this:
header("Location:/modules.php?op=modload&name=Forum&file=viewtopic&topic=$row[topic_id]&forum=$row[topic_id]");
If its more than one, let it print out as normal...