<?php
include "./db.php"; 
include "x.php"; 
$limit = 1;

$page = isset($_POST['page']) ? (int) $_POST['page'] : 1;
$offset = ($page - 1) * $limit;

$sql = "SELECT * FROM data_table 
        WHERE up_by = '$x' 
        AND page_type = 'video' 
        AND recycle = '1' 
        ORDER BY id DESC 
        LIMIT $limit OFFSET $offset";

$result = mysqli_query($con, $sql);

if ($result && mysqli_num_rows($result) > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        $youtubeId = $row['short_des'];
?>
<div class="col-md-6 col-lg-4 wow fadeInUp">
    <div class="video-item">
        <div class="video-thumb" data-videoid="<?= $youtubeId; ?>">
            <img src="https://img.youtube.com/vi/<?= $youtubeId; ?>/hqdefault.jpg"
                alt="<?= htmlspecialchars($row['title']); ?>">
            <a href="javascript:void(0);" class="play-btn">
                <i class="fas fa-play"></i>
            </a>
        </div>
    </div>
</div>
<?php
    }
} else {
    echo "no_more"; 
}
?>