I am having a weird problem: I fired the same query select DateSpan, PUE from GF.dbo.PUE Data where DateSpan between '2013-10-01 12:00:00.000' and '2013-10-31 12:00:00.000'
in SQL Server and getting proper result.
2013-10-01 12:00:00.000 1.66402976232178
2013-10-02 12:00:00.000 1.58132003529595
.. ..
However when I fetch the same query through PHP script, it loses 1st day. Don't know the reason.
SELECT DateSpan, PUE
FROM [GF].[dbo].[PUEData]
where (DateSpan >= '$stdate' AND DateSpan < '$enddate')
Probably the problem is with later array formulation -
$rows = array();
$table = array();
$table['cols'] = array(
array('label' => 'Date', 'type' => 'string'),
array('label' => $metric , 'type' => 'number')
);
$result=sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
while($r = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))
{
$temp = array();
$temp[] = array('v' => (string) $r['DateSpan']);
$temp[] = array('v' => (float) $r[$metric]);
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table,JSON_NUMERIC_CHECK);
Many thanks!