Okay, first of all, you have a little error in function_displayThreads().
You set $id=$threadsrow['ID'] and later in echo you have:
echo("<a_href=\"$_SERVER[PHP_SELF]?thread=$threadid\">$threadtitle</a><br>");
So either rename $id to $threadid or rename $threadid to $id so they are both the same 😉
Your INSERT querys are wrong. Dont use SET, thats for UPDATE.
$topics=mysql_query("INSERT INTO topics (threadtitle,threadauthor,threaddate) VALUES ('$threadtitle','$threadauthor',NOW())");
PS. There might be some more errors in your queries. You might consider to join those tables in your SELECT.