<?php 

$dir = '../';

require_once $dir.'includes/main.php';

$id = (int)$_POST['id'];
$offset = (int)$_POST['offset'];

$sql = "SELECT * FROM listings WHERE status = 'active' AND points > 0 AND category_id = '{$id}' ORDER BY points DESC, id ASC LIMIT $offset, {$per['listings']}";

$offset = $offset + 1;

fetch_elements($sql, 'elements/listings/main.php', 'x', $offset);

?>