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

I've been using punBB 1.2 for a while and I decided to upgrade to the new, nut I have a few questions...

First, I have been using the following code to pull certain topics and display them as "new" on the main page of my site

<table border="0" style="border-collapse: collapse" bordercolor="#FF4106" width="100%">
  <tr>
    <td width="100%">
    <table border="1" style="border-collapse: collapse" bordercolor="#393939" width="100%">
      <tr>
        <td background="images/cellpic2.gif" width="45%" bgcolor="#101010" align="center"><b>
        <font face="Tahoma" size="2" color="#FFFFFF">Lastest Topics</font></b></td>
        <td background="images/cellpic2.gif" width="20%" bgcolor="#101010" align="center"><b>
        <font face="Tahoma" size="2" color="#FFFFFF">Author</font></b></td>
        <td background="images/cellpic2.gif" width="8%" bgcolor="#101010" align="center"><b>
        <font face="Tahoma" size="2" color="#FFFFFF">Replies</font></b></td>
        <td background="images/cellpic2.gif" width="8%" bgcolor="#101010" align="center"><b>
        <font face="Tahoma" size="2" color="#FFFFFF">Views</font></b></td>
      </tr>

<?
  $MySQL['Server'] = "localhost"; 
  $MySQL['User'] = "root";
  $MySQL['Pass'] ="ub2742a6b";
  $MySQL['Database'] = "stkclan_forums";

  MySQL_Connect($MySQL['Server'], $MySQL['User'], $MySQL['Pass']) OR Die("Failed to establish the connection.");
  MySQL_Select_db($MySQL['Database']);
    
  $result = mysql_query("SELECT subject, id, poster, num_views, num_replies FROM stk_forumstopics WHERE forum_id = '8' OR forum_id = '9' OR forum_id = '10' OR forum_id = '11' OR forum_id = '13' OR forum_id = '14' OR forum_id = '15' OR forum_id = '16' OR forum_id = '17' OR forum_id = '18' OR forum_id = '20' ORDER BY last_post DESC LIMIT 5");
  if (!$result)
  {
  $message = "Invalid query: " . mysql_error() . "\n";
  die($message);
  }
  while ($row = mysql_fetch_assoc($result))
  {
  echo '
      <tr>
        <td width="45%" align="left">
        <p style="margin-left: 5; margin-top: 2; margin-bottom: 2"><font face="tahoma" style="font-size: 10pt"><b>
        <a style="text-decoration: none" href="forums/viewtopic.php?id=' . $row['id'] . '">'. $row['subject'] . '</a></b></font></td>
        <td width="20%" align="center"><font face="arial" style="font-size: 10pt">'. $row['poster'] . '</font></td>
        <td width="8%" align="center"><font face="arial" style="font-size: 10pt">'. $row['num_replies'] . '</font></td>
        <td width="8%" align="center"><font face="arial" style="font-size: 10pt">'. $row['num_views'] . '</font></td>
      </tr>
';
  }  
  mysql_free_result($result);
?>
    </table>
    </td>
  </tr>
</table>

I'm guessing with some simple modifications the same might still be possible?

Secondly, Does using TPL template files still work to skin my forums to look like my website? I have the following code in various areas of my forums page:

<?php
    define('PUN_ROOT', './forums/');
    define('PUN_QUIET_VISIT', 1);
    require PUN_ROOT.'include/common.php';
?>    

<pun_head>
<div id="punwrap">
<div id="pun<pun_page>" class="pun">

<div id="brdheader" class="block">
    <div class="box">
        <div id="brdtitle" class="inbox">
        </div>
        <pun_navlinks>
        <pun_status>
    </div>
</div>

<pun_announcement>

<pun_main>

<pun_footer>

</div>
</div>

Thanks for any helpful insight smile

Regards
Juston