<?php
$set['p_str'] = 5;
$k_rxn = mysql_num_rows(mysql_query("SELECT `id_foto` FROM `gallery_rating` WHERE `like` > '0'"));

$k_page = k_page($k_rxn, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];

$r_xn = mysql_query("SELECT * FROM `gallery_rating` WHERE `like` > '0' ORDER BY `like` DESC LIMIT $start, $set[p_str]");
?>
<link rel="stylesheet" href="/style/css/owl.carousel.css">
<link rel="stylesheet" href="/style/css/owl.theme.default.min.css">
<script src="/style/js/owl.carousel.js"></script>

<script>
    $('.owl-carousel').owlCarousel({
        loop: true,
        margin: 10,
        nav: true,
        responsive: {
            0: {
                items: 1
            },
            600: {
                items: 3
            },
            1000: {
                items: 5
            }
        }
    })

    $(document).ready(function () {
        $(".owl-carousel").owlCarousel();
    });
</script>
<?php
echo "<div class='owl-carousel owl-theme'>";
while ($ank = mysql_fetch_array($r_xn)) {

    $f = $ank['id_foto'];
    $foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_rating` WHERE `id_foto` = '" . $f . "'  LIMIT 1"));
    $gallery = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id`='" . $foto['avtor'] . "'  LIMIT 1"));
    $ank_p = get_user($gallery['id_user']);

    echo "<div class='item'>";
    echo "<img src='/modules/foto/foto/$foto[id_foto]' height='100' /><br />";
    echo "<small class='text-muted'><i class='fa fa-star fa-fw'></i> $foto[like]</small>";
    echo "</div>";
}

echo "</div>";
