public function __construct($database) { $ini = parse_ini_file("site.ini"); try { $this->db = new MeekroDB($ini["db"], $ini["db_user"], $ini["db_pass"], $database); } catch (MeekroDBException $error) { //SQL Error SQLErrorCatch($error); } }
public function GetReportChart($starttime, $endtime, $localtime, $maxlimit) { $time = " inserttime " . chooseDates($starttime, $endtime); $sql = "SELECT DATE_FORMAT(inserttime, %l_dates) AS hour, water, air, ph\n\t\t\tFROM results\n\t\t\tWHERE {$time}\n\t\t\tORDER BY inserttime DESC\n\t\t\tLIMIT {$maxlimit}"; try { $sqlResult = $this->db->query($sql, array("dates" => "'%Y-%m-%d %H:00'", 'starttime' => $starttime, 'endtime' => $endtime, 'localtime' => $localtime)); } catch (MeekroDBException $error) { //SQL Error SQLErrorCatch($error); } return json_encode($sqlResult, JSON_NUMERIC_CHECK); }