From f82e5456d22af7e39a22a9a64e74072cf01e0a31 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 28 Jul 2017 20:11:09 +0200 Subject: dried code by introducing selectOne for select queries with only one result line expected --- includes/pages/admin_active.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'includes/pages/admin_active.php') diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 2e06f90d..be1217ff 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -210,19 +210,17 @@ function admin_active() $shirt_statistics = []; foreach (array_keys($tshirt_sizes) as $size) { if (!empty($size)) { - $sc = DB::select( + $sc = DB::selectOne( 'SELECT count(*) FROM `User` WHERE `Size`=? AND `Gekommen`=1', [$size] ); $sc = array_shift($sc); - $sc = array_shift($sc); - $gc = DB::select( + $gc = DB::selectOne( 'SELECT count(*) FROM `User` WHERE `Size`=? AND `Tshirt`=1', [$size] ); $gc = array_shift($gc); - $gc = array_shift($gc); $shirt_statistics[] = [ 'size' => $size, @@ -232,8 +230,7 @@ function admin_active() } } - $uc = DB::select('SELECT count(*) FROM `User` WHERE `Tshirt`=1'); - $uc = array_shift($uc); + $uc = DB::selectOne('SELECT count(*) FROM `User` WHERE `Tshirt`=1'); $uc = array_shift($uc); $shirt_statistics[] = [ -- cgit v1.2.3-54-g00ecf