HI All,
Im working on learning PHP, and i have this script i need to do some simply editing. The only problem is that I just can seem to get the results I need. the script calls for the last entries in my forum to show on my home page. the script is from the punbb forum. (exten.php)
Here is the part that they told me i needed to edit, but I can not get the results after post again with no response, I thought I would try here.
I want to add the field t.poster to this, so it will show the person who posted the topic. Also i need to according to them is echo the results. I have tried may ways to edit this, but with no luck.
can someone please help me with this?
Script:
// Fetch $show topics
$result = $db->query('SELECT t.id, t.subject FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON t.forum_id=f.id WHERE t.moved_to IS NULL AND '.$forum_sql.'f.admmod_only=0 ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', FILE, LINE, $db->error());
while ($cur_topic = $db->fetch_assoc($result))
{
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
if (pun_strlen($cur_topic['subject']) > $max_subject_length)
$subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
else
$subject_truncated = $cur_topic['subject'];
echo '<b>·</b> <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a><br>'."\n";
}
}
exit;
}
With my knowledge of PHP I know t.poster must go in this line:
$result = $db->query('SELECT t.id, t.subject, t.poster FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON t.forum_id=f.id WHERE t.moved_to IS NULL AND '.$forum_sql.'f.admmod_only=0 ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', FILE, LINE, $db->error());
But is the echo part that is messing me up the most.
Thanks in Advance
Daryl