Show list of node titles from a certain taxonomy term
You have to enclose table names in curly braces {} everywhere they appear, not just in the FROM and JOIN clauses. So the correct query would be 

SELECT {node}.title, {node}.nid
FROM {node}
INNER JOIN {term_node} ON {node}.nid = {term_node}.nid
WHERE {term_node}.tid = %d
ORDER by {node}.title ASC


You can also use table aliases instead.

If you use table prefixes, your query should have resulted in an error. Turn on PHP's error reporting if you did not see any error message.

If you do not use table prefixes, then the reason is, that the database query simply returns an empty result set (i.e. no node is tagged with the taxonomy term that has 5 as tid). 

Also note the following:


In the line

$nodes = l($node-&gt;title, 'node/'.$node-&gt;nid);


you overwrite the previous result and thus the previous result is lost. But if a result would actually exist, at least the last result should be printed. Nevertheless, use

$nodes[] = l($node-&gt;title, 'node/'.$node-&gt;nid);


to be able to use all results.
You pass three arguments to the query (5, 0, 30), but the query only has one parameter (term_node.tid = %d). Are you sure that 5 is the tid you are interested in? The other arguments are ignored.
If you create a new revision of a node that has the requested term and then remove the term from the new revision, the node will still appear in the result set. Join on the vid of the node instead of on the nid to prevent this.