Cod: Selectaţi tot
<?
// schimbati calea catre forum
$path = '../demoforum/';
// suma topicurilor afisate
$amount = 5;
// numarul forumului ce nu trebuie afisat
$exclude = '';
// ------ mai jos nu e nevoie sa editati ------ //
require_once("{$path}config.php");
$conid = mysql_connect($dbhost, $dbuser, $dbpasswd);
$db = mysql_select_db($dbname, $conid);
unset($dbpasswd);
$sql_where = 'WHERE `forum_id` > -1 ';
if($exclude != '')
{
$exclude_forums = explode(',', $exclude);
foreach ($exclude_forums as $id)
{
if ($id > 0)
{
$sql_where .= ' AND `forum_id` <> ' . trim($id);
}
}
}
$sql = "SELECT `topic_id`, `topic_title` FROM `{$table_prefix}topics` {$sql_where} ORDER BY `topic_time`DESC LIMIT 0, {$amount}";
$result = mysql_query($sql, $conid);
$topics_html = '';
while($topic = mysql_fetch_array($result))
{
$topics_html .= "<a href=\"{$path}viewtopic.php?t={$topic['topic_id']}\">{$topic['topic_title']}</a><br />";
}
mysql_close($conid);
echo $topics_html;
?>