I was trying to avoid doing it for you but maybe you will learn more from seeing how it should be.
PHP Code:
$result = $db->query_read("SELECT vbfclassifieds_ads.title, vbfclassifieds_ads.userid, vbfclassifieds_ads.id, user.userid, user.username FROM vbfclassifieds_ads LEFT JOIN user ON vbfclassifieds_ads.userid = user.userid LIMIT 5");
$displaydata = '
<table border="0">
<tr>
<th>Title</th>
<th>Username</th>
</tr>
';
while($row = $db->fetch_array($result))
{
$displaydata .= '
<tr>
<td>
<a href="vbfclassifieds.php?do=showad&adid='. $row['id'] .'">
'. $row['title'] .'
</a>
</td>
<td>
<a href="/member.php?u='. $row['userid'] .'">
'. $row['username'] .'
</a>
</td>
</tr>
';
}
$displaydata .= '</table>';
Then use
$displaydata in your template.