3) { mysql_connect($ini['db']['host'],$ini['db']['user'],$ini['db']['pass']); mysql_select_db($ini['db']['db']); $sql=mysql_query('SET CHARACTER SET utf8'); $sql=mysql_query("SELECT latitude,longitude,depth,magnitude,pop25,pop100,pop200,cdi AS intensity,place,tsunami,url,provider,data,TIMESTAMPDIFF(MINUTE,data,NOW()) AS difference,weather_code as wc,icon as ic,clouds as cl,wind_speed as ws,pressure as pr,humidity as hu,temperature as te FROM (select * from automatic_all) as a WHERE a.data > date_sub(NOW(), interval 1440 minute) AND a.magnitude>=2 AND a.provider NOT LIKE 'PHIVOLCS' ORDER BY a.data DESC"); if (mysql_num_rows($sql)){ while($e=mysql_fetch_assoc($sql)) $output_file[]=$e; $json_file = json_encode($output_file); file_put_contents($filename,$json_file); } mysql_close(); } $data = file_get_contents($filename); print($data); ?>