public static function getCounts($tableName, $where = null) { if (!$tableName) { return false; } if ($where) { $where = " WHERE {$where}"; } $sql = "SELECT count(id) AS counts FROM " . $tableName . $where; $rs = DB::GetQueryResult($sql, false); self::$_total = isset($rs[0]['counts']) ? (int) $rs[0]['counts'] : 0; return self::$_total; }