<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 7/2/2012	ELL
// Revised: 2/12/2013	ELL
// Added paging of user tables.
// 
// 
// 
	
	include ("./check_session.php");
	
	$user_table = $_POST['user_table'];
	$page = $_POST['page'];
	$max_rec = $_POST['max_rec'];
	$_SESSION['last_user_table'] = $user_table;
		
	$start_row = $page * $max_rec;
	$query = "SELECT * FROM " . $user_table . " ORDER BY `UserID` LIMIT " . $start_row . "," . $max_rec;
//	echo $query;
//	exit;

	$result = $bwb_dbh->query($query);
	
	if ($result->rowCount() < 1)
	{
		echo "-no data-";
		exit;
	}

	$row_delim = "";
	while ($row = $result->fetch(PDO::FETCH_ASSOC))
	{
		$table .= $row_delim . json_encode($row);
		$row_delim = "@@@@@";
	}
	
	print $table;
?>