Вывод 3-х тем

198
.
ROMAKOT
Дайте код вывода на главной последних 3-х тем в которых написали смс
.
~ PHP-7 & REGEXP - This is a really powerful kit ~
ROMAKOT, тут есть несколько вариантов
.
echo '<div class="phdr"><b>Posledniy temi forum</b></div>';


$req = mysql_query("SELECT `id`,`text`, `from`  FROM `forum` where type='t' ORDER BY time DESC LIMIT 5; ");
while ($arr = mysql_fetch_array($req)){
$nikuser = mysql_query("SELECT `from`,`time`,`text` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $arr['id'] . "'ORDER BY time DESC LIMIT 1;");
$nam = mysql_fetch_array($nikuser);
$colmes = mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `refid`='" . $arr['id'] . "'" . ($rights >= 7 ? '' : " AND `close` != '1'"));
                    $colmes1 = mysql_result($colmes, 0);
echo'<div class="menu">';
echo "<a href='forum/index.php?id=".$arr['id']."'>$arr[text]</a>[$colmes1]<br/>(".$arr['from']."/".$nam['from']."";
$vrp = $nam['time'] + $set_user['sdvig'] * 3600;
                    echo ' <font color="#777777">' . date("d.m.y / H:i", $vrp) . ")</font>";
echo'('.mysql_result(mysql_query("select count(*) from `cms_forum_rdm` where `topic_id`=".$id),0).')</div>';
}
Всего: 3