<?php
@mysql_connect("localhost", "root", "")
or die();
mysql_select_db("random_base");
mysql_set_charset("utf8");
header('Content-Type: application/json; charset=utf8');
$arr=array();
if(isset($_GET['static_rows'])) {
$sql_static_load="SELECT * FROM `time` LIMIT 0,"." ".$_GET['static_rows']
or die();
$q=mysql_query($sql_static_load)
or die();
for($i=0;$i<mysql_num_rows($q);$i++)
$arr=array("t".($i+1)=> array(mysql_result($q, $i, 0), mysql_result($q, $i, 1), mysql_result($q, $i, 2)));
} else {
$sql_new_load="SELECT * FROM `time` LIMIT ".$_GET['current_rows'].", ".($_GET['current_rows'] + $_GET['new_rows'] - 1)
or die();
$q=mysql_query($sql_new_load)
or die();
for($i=0;$i<mysql_num_rows($q);$i++)
$arr=array("t".($i+1)=> array(mysql_result($q, $i, 0), mysql_result($q, $i, 1), mysql_result($q, $i, 2)));
}
echo json_encode($arr);
}