connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $r=mysqli_query($mysqli, "select UNIX_TIMESTAMP(time) as time,$id as amps from device_log where time>FROM_UNIXTIME($oldtime)", MYSQLI_USE_RESULT); #$r=mysqli_query($mysqli, "select UNIX_TIMESTAMP(time) as time,$id as amps from device_log where time>FROM_UNIXTIME($oldtime)"); #$result=mysqli_query($mysqli, $sqlquery, MYSQLI_USE_RESULT); $myArray = array(); #if ($result = $mysqli->store_result()) { # echo "hi"; while($row = mysqli_fetch_assoc($r)) { #while($row = mysqli_fetch_row($r)) { #echo "
";
#print_r($row);
list($counter,$iforget,$amps)=explode(",",$row['amps']);
#list($counter,$iforget,$amps)=explode(",",$row[1]);
$row['amps']=$amps;
$myArray[] = $row;
unset($counter);
unset($iforget);
unset($amps);
}
# $result->free();
#}
#print_r($myArray);
#echo "";
echo json_encode($myArray);
?>