Anyone know how to make when you are looking topics on any category and next to theme name to write number of times topic viewed?
Anyone know how to make when you are looking topics on any category and next to theme name to write number of times topic viewed?
Add in your sql db
ALTER TABLE `forum` ADD `view` int(11) NOT NULL default '0';echo '</p>';
if (!$user_id) {
if ((empty($_SESSION['uppost'])) || ($_SESSION['uppost'] == 0)) {
echo '<a href="index.php?id=' . $id . '&page=' . $page . '&newup">' . $lng_forum['new_on_top'] . '</a>';
} else {
echo '<a href="index.php?id=' . $id . '&page=' . $page . '&newdown">' . $lng_forum['new_on_bottom'] . '</a>';
}
}
}mysql_query("UPDATE forum SET view = view + 1 WHERE id = $id");echo '<div class="phdr"><a name="up" id="up"></a><a href="#down"><img src="../theme/' . $set_user['skin'] . '/images/down.png" alt="????" width="20" height="10" border="0"/></a> <b>' . $type1['text'] . '</b></div>';echo '<div class="phdr"><a name="up" id="up"></a><a href="#down"><img src="../theme/' . $set_user['skin'] . '/images/down.png" alt="????" width="20" height="10" border="0"/></a> <b>' . $type1['text'] . '|'.$type1['view'].' Views </b></div>';It counts for every topic, when i view one topic, it gives +1 view to all topics in that category
I making in categories where it shows list of topics under name of topic shows number of views, but when i visit one topic it counts for all topics
It works in topic but how can it show in list of topics number of views?
Never mind i figured it, just in list of topics type
' . $res['view'] . '// Выводим название топикаI want to make themes order by views except i dont know how to make it to read from views not time
Here is my code for last themes
$kmessreq= 6;
$startreq = isset($_REQUEST['page']) ? $page * $kmessreq - $kmessreq : (isset($_GET['start']) ? abs(intval($_GET['start'])) : 0);
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 't' and `kedit`='0' AND `close`!='1' "), 0);
$req = mysql_query("SELECT * FROM `forum` WHERE `type` = 't' and kedit='0' AND `close`!='1' ORDER BY `time` DESC LIMIT $startreq, $kmessreq");
while ($arr = mysql_fetch_assoc($req)) {
$nikuser = mysql_query("SELECT `from`,`id`, `time` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $arr['id'] . "' ORDER BY time DESC");
$colmes1 = mysql_num_rows($nikuser);
$cpg = ceil($colmes1 / $kmess);
$nam = mysql_fetch_assoc($nikuser);
echo '<div class="teme">';
echo '</b>';
echo ' <a href="forum/index.php?id=' . $arr['id'] . '">' . $arr['text'] . '</a> [' . $colmes1 . ']';
if ($cpg > 1)
echo '<a href="forum/index.php?id=' . $arr['id'] . '&page=' . $cpg . '">>></a>';
if ($colmes1 > 1){
echo ' <font color="red">~ '.$nam['from'].' </font>';
}else
echo ' <font color="red">~ '.$arr['from'].'</font>';
echo '<br/><span class="gray">(' . functions::display_date($arr['time']) . ')</span> | <span class="gray">Pregleda: ' . $arr['view'] . '</span>';
echo '</div>';
}