$db=mysql_connect ($dbhost,$dbuser,$dbpasswd) or die ("Error!");
mysql_select_db("$dbname");
$qboard='select T.topic_id, T.topic_title, U.username, T.topic_time, T.topic_replies, T.topic_poster, P.post_username, T.topic_views, T.topic_replies
from '.$table_prefix.'topics as T
left join '.$table_prefix.'posts as P on T.topic_first_post_id=P.post_id
left join '.$table_prefix.'users as U on U.user_id=T.topic_poster
order by T.topic_last_post_id desc limit 12';
$rboard=mysql_query($qboard, $db) or die("Error".mysql_error());
if ($rowb[4]!=0) {
$qboard2='select U.username, P.post_time, P.poster_id, P.post_username
from '.$table_prefix.'posts as P
left join '.$table_prefix.'users as U on U.user_id=P.poster_id
where P.topic_id='.$rowb[0].' order by P.post_time desc limit 1';
$rboard2=mysql_query($qboard2, $db);
$rowb2=mysql_fetch_array($rboard2);