Yangi formatda davom etish uchun: https://uzfor.net/view.php?act=post&id=79250
Postga havola
AbdusattarovZ [834] [off]
Bu kodga limit qo'yib berilar iltimos. 5 ta maqola chiqadigan qib faqat
<?php echo '<div class="phdr"><b><a href="?">Ko\'p o\'qilganlar </b></div>'; if ($sort == 'read' || $sort == 'comm') { $total = mysql_result(mysql_query('SELECT COUNT(*) FROM `library_texts` WHERE ' . ($sort == 'comm' ? '`count_comments`' : '`count_views`') . ' > 0 ORDER BY ' . ($sort == 'comm' ? '`count_comments`' : '`count_views`') . ' DESC LIMIT 20'), 0); } else { $sql = mysql_query("SELECT COUNT(*) AS `cnt`, AVG(`point`) AS `avg` FROM `cms_library_rating` GROUP BY `st_id` ORDER BY `avg` DESC, `cnt` DESC LIMIT 20"); } $start = $page == 1 ? 0 : ($page - 1) * $kmess; if (!$total) { echo '<div class="menu"><p>' . $lng['list_empty'] . '</p></div>'; } else { if ($sort == 'read' || $sort == 'comm') { $sql = mysql_query('SELECT `id`, `name`, `time`, `uploader`, `uploader_id`, `count_views`, `cat_id`, `comments`, `count_comments`, `announce` FROM `library_texts` WHERE ' . ($sort == 'comm' ? '`count_comments`' : '`count_views`') . ' > 0 ORDER BY ' . ($sort == 'comm' ? '`count_comments`' : '`count_views`') . ' DESC LIMIT ' . $start . ',' . $kmess); } else { $sql = mysql_query("SELECT `library_texts`.*, COUNT(*) AS `cnt`, AVG(`point`) AS `avg` FROM `cms_library_rating` JOIN `library_texts` ON `cms_library_rating`.`st_id` = `library_texts`.`id` GROUP BY `cms_library_rating`.`st_id` ORDER BY `avg` DESC, `cnt` DESC LIMIT " . $start . ',' . $kmess); } $i = 0; echo '<div class="list' . (++$i % 2 ? 2 : 1) . '">' . '<div><a href="index.php?id=' . $row['id'] . '">' . functions::checkout($row['name']) . '</a>' . '<div><small>' . functions::checkout(bbcode::notags($row['announce'])) . '</small></div></div>'; // Malumot $rate = new Rating($row['id']); echo '<div class="sub"><b>' . $lng['section'] . ':</b> <a href="?do=dir&id=' . $row['cat_id'] . '">' . functions::checkout(mysql_result(mysql_query("SELECT `name` FROM `library_cats` WHERE `id`=" . $row['cat_id']), 0)) . '</a> || <b>' . functions::display_date($row['time']) . ' </b>|| <b>' . $lng_lib['reads'] . ':</b> ' . $row['count_views'] . ' </div>'; echo '</div>'; } }
Bu kodga limit qo'yib berilar iltimos. 5 ta maqola chiqadigan qib faqat