<?php
ini_set('display_errors', 1);

error_reporting(E_ALL);

	$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
	$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
      
	$offset = ($page-1)*$rows;
	$result = array();

        /*echo '<script>
            var a="'.$offset.'"
            alert (a);
        </script>'; 
        */
        include "../DMMYSQLG.php";

        
        mysqli_query($con ,"SET NAMES 'utf8'");
        
   
        
	$rs = mysqli_query($con ,"select count(*) from dxopemaex");

	$row = mysqli_fetch_row($rs);
 
	$result["total"] = $row[0];
	$rs = mysqli_query($con ,"select * from dxopemaex limit $offset,$rows");

	$items = array();
	while($row = mysqli_fetch_object($rs)){

		array_push($items, $row);
	}

	$result["rows"] = $items;

	echo json_encode($result);

?>
