[UPDATED] Query improved for first blocks time

This commit is contained in:
Sebastian Grewe 2013-11-11 12:42:35 +01:00
parent 629dfb58ed
commit 9ccc3403f8

View File

@ -30,9 +30,7 @@ class Statistics extends Base {
$this->debug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
$stmt = $this->mysqli->prepare("
SELECT
IFNULL(time, 0) AS time FROM " . $this->block->getTableName() . "
ORDER BY id ASC LIMIT 1");
SELECT IFNULL(MIN(time), 0) AS time FROM " . $this->block->getTableName());
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_object()->time;
return false;