Cod: Selectaţi tot
<?php
$forum_folder = 'forum/';
$nr_topicuri = 5;
//////////////////////////////////////
include $forum_folder . 'config.php';
mysql_select_db($dbname);
$query = mysql_query('select ' . $table_prefix . 'posts.post_id, ' . $table_prefix . 'topics.topic_id, ' . $table_prefix . 'topics.topic_title from ' . $table_prefix . 'posts, ' . $table_prefix . 'topics where ' . $table_prefix . 'posts.topic_id = ' . $table_prefix . 'topics.topic_id order by ' . $table_prefix . 'posts.post_time desc');
$topicuri_gasite = array();
$n = 0;
while ($row = mysql_fetch_array($query))
{
if ($n == $nr_topicuri) break;
if (!in_array($row['topic_id'] , $topicuri_gasite))
{
$topicuri_gasite[count($topicuri_gasite)] = $row['topic_id'];
echo '<a href="' . $forum_folder . 'viewtopic.php?t=' . $row['topic_id'] . '">' . $row['topic_title'] . '</a> ';
echo '<a href="' .$forum_folder. 'viewtopic.php?p=' . $row['post_id'] . '#' . $row['post_id'] . '"><img src="' . $root_folder . 'forum/templates/subSilver/images/icon_latest_reply.gif" border="0" alt="" /></a>';
echo '<br />';
$n++;
}
}
// nu uitati sa dati un mysql_select_db() inapoi pe baza de date
// initiala daca este cazul
?>
