The page displays the goods in the following way:
<?php $i = 0; $num_rec_per_page=20; if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; } $start_from = ($page-1) * $num_rec_per_page; $sql = "SELECT * FROM goods ORDER BY (clicks/views)*points DESC LIMIT $start_from, $num_rec_per_page"; $rs_result = mysql_query ($sql); ?> <?php while ($row = mysql_fetch_assoc($rs_result)) { //выводятся товары } ?> That is, they are sorted using this mathematical operation:
(clicks/views)*points When accessing the page, the GET parameter goods_id can be specified, where the goods IDs are separated by commas (? Goods_id = 1,2,3). It is necessary when sorting goods to raise these goods to the top, that is, they must be first in the list. In the extreme case, it is possible for goods_id to contain only one ID, and the product with that ID is the first to be sorted.