One it is best to use vBulletin db functions so you only use one database connection.
https://vborg.vbsupport.ru/showthrea...database+class
But if you want to stay with the mysql default functions, it would probably be best to change your code to this.
PHP Code:
chdir('./forums');
require_once('./global.php');
require_once('./includes/class_bbcode.php');
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$dbhost = 'localhost';
$dbname = '*****';
$dbuser = '*****';
$dbpass = '*****';
$dbconnection = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $dbconnection);
$sql = 'SELECT post.pagetext, thread.*
FROM post AS post, thread AS thread
LEFT JOIN forum AS forum ON (forum.forumid = thread.forumid)
WHERE FIND_IN_SET(4, forum.parentlist) AND post.postid = thread.firstpostid
ORDER BY thread.dateline DESC
LIMIT 5';
$sqlresult = mysql_query($sql, $dbconnection) or die(mysql_error());
$count = mysql_num_rows($sqlresult);
while ($row = mysql_fetch_array($sqlresult))
{
$subject = $row['title'];
$poster = $row['postusername'];
$posterid = $row['postuserid'];
$time = date("D, M j, Y", $row['dateline']);
$replies = $row['replycount'];
$id = $row['threadid'];
$text = $parser->do_parse($row['pagetext'], true, true, true, true, true, false);
if ($replies == 1)
$replytext = 'reply';
else
$replytext = 'replies';
echo "<b>$subject</b>";
echo '<br>';
echo '<font style="font-size: 8pt;">';
echo "Posted by <a href=\"forums/member.php?u=$posterid\">$poster</a> on $time (<a href=\"forums/showthread.php?t=$id\">$replies $replytext</a>)";
echo '</font>';
echo '<br><br>';
echo $text;
}
mysql_close($dbconnection);
echo '<br><br><div style="float: right;"><a href="forums/forumdisplay.php?f=4">News Archive Forum</a></div>';