$query = mysql_query(" SET @c1=0; SELECT @c1 := @c1+1 as Week,
AVG(Temp) AS Average_Temperature FROM ( SELECT t1.*, COUNT(*) cnt
FROM test2 t1 LEFT JOIN test2 t2
ON t2.Date <= t1.Date
AND YEAR(FROM_UNIXTIME(t2.Date)) = YEAR(FROM_UNIXTIME(t1.Date))
AND MONTH(FROM_UNIXTIME(t2.Date)) = MONTH(FROM_UNIXTIME(t1.Date)) GROUP
BY Date ) t GROUP BY YEAR(FROM_UNIXTIME(Date)), MONTH(FROM_UNIXTIME(Date)), CEIL(cnt/7);" );
If I dont use SET @c1=0; I got no error... So whats the use of this on json php? Above code successfully queried on PHPMyAdmin.
edit: solved
mysql_query