From eecd2bf71d944d24199c28162a3f535e051a8d3b Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 11 Oct 2022 17:10:44 +0100 Subject: [PATCH] [welcome] SQL statements being totally wrong --- application/controllers/Welcome.php | 3 +-- application/models/Api_model.php | 2 +- application/models/Logbooks_model.php | 2 +- application/models/Note.php | 2 +- application/models/Stations.php | 2 +- application/views/welcome/index.php | 4 ++-- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php index 59ec5176..36e69dc6 100644 --- a/application/controllers/Welcome.php +++ b/application/controllers/Welcome.php @@ -11,7 +11,6 @@ class Welcome extends CI_Controller { public function index() { - if($this->optionslib->get_option('version2_trigger') == "false") { $data['page_title'] = "Welcome to Cloudlog Version 2.0"; @@ -31,7 +30,7 @@ class Welcome extends CI_Controller { $this->load->model('note'); $data['NumberOfNotes'] = $this->note->CountAllNotes(); - if($data['CountAllStationLocations'] == 0 || $data['NumberOfStationLogbooks'] == 0 || $data['NumberOfAPIKeys'] > 0 || $data['NumberOfNotes'] > 0) { + if($data['CountAllStationLocations'] > 0 || $data['NumberOfStationLogbooks'] > 0 || $data['NumberOfAPIKeys'] > 0 || $data['NumberOfNotes'] > 0) { // load views $this->load->view('interface_assets/mini_header', $data); $this->load->view('welcome/index'); diff --git a/application/models/Api_model.php b/application/models/Api_model.php index ba2d3553..76ede10a 100644 --- a/application/models/Api_model.php +++ b/application/models/Api_model.php @@ -15,7 +15,7 @@ class API_Model extends CI_Model { } function CountKeysWithNoUserID() { - $this->db->where('user_id !=', NULL); + $this->db->where('user_id =', NULL); $query = $this->db->get('api'); return $query->num_rows(); } diff --git a/application/models/Logbooks_model.php b/application/models/Logbooks_model.php index f4644342..d99c4bb5 100644 --- a/application/models/Logbooks_model.php +++ b/application/models/Logbooks_model.php @@ -9,7 +9,7 @@ class Logbooks_model extends CI_Model { function CountAllStationLogbooks() { // count all logbooks - $this->db->where('user_id !=', NULL); + $this->db->where('user_id =', NULL); $query = $this->db->get('station_logbooks'); return $query->num_rows(); } diff --git a/application/models/Note.php b/application/models/Note.php index 0ace033a..8c03ccaa 100644 --- a/application/models/Note.php +++ b/application/models/Note.php @@ -57,7 +57,7 @@ class Note extends CI_Model { function CountAllNotes() { // count all notes - $this->db->where('user_id', NULL); + $this->db->where('user_id =', NULL); $query = $this->db->get('notes'); return $query->num_rows(); } diff --git a/application/models/Stations.php b/application/models/Stations.php index 9bd40ad6..07bd4b7a 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -157,7 +157,7 @@ class Stations extends CI_Model { } function CountAllStationLocations() { - $this->db->where('user_id !=', NULL); + $this->db->where('user_id =', NULL); $query = $this->db->get('station_profile'); return $query->num_rows(); } diff --git a/application/views/welcome/index.php b/application/views/welcome/index.php index e613f08f..75858e5c 100644 --- a/application/views/welcome/index.php +++ b/application/views/welcome/index.php @@ -92,7 +92,7 @@
- + 0) { ?>
Assign ALL Station Locations to this username
@@ -104,7 +104,7 @@
- + 0) { ?>
Create Station Logbooks