Topic: unable to fetch topic list

Hello,

I've been using the following script to fetch important posts from my forums and display them as "news" on the main page of my website:

<?php

/**
Punbb News Script
Written by: Jesse Spillane (http://www.jessespillane.com)
*/

$news_forum_id = 21;
$news_forum_id2 = 2;
$news_forum_id3 = 5;
$news_forum_id4 = 14;
$limit = 7;
$forum_path = './forums/';

define('PUN_ROOT', $forum_path);

define('PUN_TURN_OFF_MAINT', 1);
define('PUN_QUIET_VISIT', 1);

require PUN_ROOT.'include/parser.php';
$result = $db->query('select id, subject, num_replies, posted from '.$db->prefix.'topics WHERE forum_id='.$news_forum_id.' OR forum_id='.$news_forum_id2.' OR forum_id='.$news_forum_id3.' OR forum_id='.$news_forum_id4.' OR forum_id='.$news_forum_id5.' ORDER BY -posted LIMIT '.$limit.';')or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_assoc($result))
{
    $id = $row['id'];
    $subject = $row['subject'];
    $num_replies = $row['num_replies'];
    $posted = date("F j, Y, g:i a", $row['posted']);

    $result2 = $db->query('select message, poster from '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY id LIMIT 1 ')or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    
    $post = $db->fetch_assoc($result2);
    $message = parse_message($post['message'], 1);
    $poster = $post['poster'];

?>
<br>
<table bgcolor="#171717" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="650" height="68">
  <tr>
    <td width="650" height="23" background="images/cellpic2.gif" colspan="2">    <p style="margin: 1 10">
    <font face="tahoma" style="font-size: 11pt" color="#FFFFFF"><b><?php echo '<a href='.$forum_path.'viewtopic.php?id='.$id.'">
    </font><font face="Arial" size="2" style="font-size: 11pt">'.$subject.'</a>'; ?></b></font></td>
  </tr>
  <tr>
    <td width="650" height="26" colspan="2"><font face="tahoma" size="2" color="#FFFFFF"><p style="margin: 1 10"><?php echo $message;?></font></td>
  </tr>
  <tr>
    <td width="527" height="19">&nbsp;</td>
    <td width="123" height="19" background="images/cellpic2.gif">
    <p align="right" style="margin: 4 10"><i>
    <font face="tahoma" style="font-size: 9pt" color="#FFFFFF"><?php
    echo '<a style="text-decoration: none" href='.$forum_path.'viewtopic.php?id='.$id.'">
   '.$num_replies.' Comment(s)</a>';
   ?></font></i></td>
  </tr>
</table>



<?php

}

?>

After making a backup of my website & relocating it to a new server, I am getting this error:

An error was encountered
Error: Unable to fetch topic list.

I have double checked the database information and it is correct, the topic IDs are correct, So I'm confuised at what might be wrong. Can someone maybe help?

Regards,
Juston