From 9e422756f92f2bd87594bb760df5e868e140d902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20M=C3=A4del?= Date: Mon, 17 Jun 2019 18:39:09 +0200 Subject: [PATCH 1/2] removed hardcoded table name --- application/models/Dxcc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 94bcdbe4..99d02908 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -32,7 +32,7 @@ class DXCC extends CI_Model { function get_worked_bands() { // get all worked slots from database $data = $this->db->query( - "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `TABLE_HRD_CONTACTS_V01`" + "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."`" ); $worked_slots = array(); foreach($data->result() as $row){ @@ -54,7 +54,7 @@ class DXCC extends CI_Model { $data = $this->db->query( "select COL_COUNTRY, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_COUNTRY) as cnt - from TABLE_HRD_CONTACTS_V01 + from ".$this->config->item('table_name')." group by COL_COUNTRY, COL_MODE, COL_BAND" ); From a311be9dd2bf02229963de0f494df840eaca4593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20M=C3=A4del?= Date: Mon, 17 Jun 2019 18:42:57 +0200 Subject: [PATCH 2/2] fix undefined array index warning --- application/models/Dxcc.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 99d02908..59a74464 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -68,6 +68,12 @@ class DXCC extends CI_Model { } // update stats + if (!isset($results[$row->COL_COUNTRY])) + $results[$row->COL_COUNTRY] = []; + + if (!isset($results[$row->COL_COUNTRY][$row->COL_BAND])) + $results[$row->COL_COUNTRY][$row->COL_BAND] = 0; + $results[$row->COL_COUNTRY][$row->COL_BAND] += $row->cnt; }