The problem you're having is because the result resource $res, $res2 etc, are not populated. This means that an error occurred either during the query or before that.
Go to line 81, which should be
Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY Level DESC LIMIT 1;")
Modify it, changing it to:
Code:
$res = mysql_query("SELECT CharName FROM characters ORDER BY Level DESC LIMIT 1;")or die ('Error: ' . mysql_error());
Save it and then load it in a web-browser. Somewhere, you should see Error: and then an error. Copy/paste the error here, please.