Doh, oh yeah, I guess that would help too, lol:

$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];

I've integrated PunBB into my Wordpress site, and after doing so, it shows up, but when I click on the "Test Forum" link I get the following error:

File: ...../barrow-downs/wp-content/forum/viewforum.php
Line: 136

PunBB reported: Unable to fetch topic list

Database reported: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY sticky DESC, last_post DESC LIMIT 0, 30' at line 1 (Errno: 1064)

Any help sorting this out would be great. Thanks.