summaryrefslogtreecommitdiff
path: root/app/Stats.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2018-09-16 14:37:55 +0100
committerGreg Roach <fisharebest@webtrees.net>2018-09-16 14:37:55 +0100
commit33f5df10ac67eec13d9d5594e91b5a80fd78272a (patch)
tree14b19dfc18d76b07851247783a93149581a9a8aa /app/Stats.php
parent9916eaed845233890edf3ae53f7a218a3b4398e5 (diff)
downloadwebtrees-33f5df10ac67eec13d9d5594e91b5a80fd78272a.tar.gz
webtrees-33f5df10ac67eec13d9d5594e91b5a80fd78272a.tar.bz2
webtrees-33f5df10ac67eec13d9d5594e91b5a80fd78272a.zip
Fix error in stats
Diffstat (limited to 'app/Stats.php')
-rw-r--r--app/Stats.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/Stats.php b/app/Stats.php
index 93828496a4..12f36d102d 100644
--- a/app/Stats.php
+++ b/app/Stats.php
@@ -5235,9 +5235,13 @@ class Stats
*/
public function averageChildren(): string
{
- $rows = (float) $this->runSql("SELECT AVG(f_numchil) AS tot FROM `##families` WHERE f_file={$this->tree->getTreeId()}");
+ $average = (float) Database::prepare(
+ "SELECT AVG(f_numchil) AS tot FROM `##families` WHERE f_file = :tree_id"
+ )->execute([
+ 'tree_id' => $this->tree->getTreeId(),
+ ])->fetchOne();
- return I18N::number($rows[0]->tot, 2);
+ return I18N::number($average, 2);
}
/**