This commit is contained in:
2026-03-10 16:19:32 +01:00
parent 44bc260061
commit c8fc4767a1
2 changed files with 24 additions and 3 deletions
+13 -2
View File
@@ -77,10 +77,21 @@ class MY_Model extends CI_Model{
function get_query_result(){
$query = $this->db->query($this->sql);
if($query === FALSE){
log_message('error', 'Database query failed: ' . $this->db->error()['message'] . ' | SQL: ' . $this->sql);
$error = $this->db->error();
log_message('error', 'Database query failed: ' . $error['message'] . ' | SQL: ' . $this->sql);
// Tijdelijk ook direct tonen voor debugging
if(ENVIRONMENT !== 'production'){
echo "SQL Error: " . $error['message'] . "\n";
echo "SQL: " . $this->sql . "\n";
}
return FALSE;
}
if($query->num_rows()==0){
$num_rows = $query->num_rows();
// Tijdelijk loggen voor debugging
if(ENVIRONMENT !== 'production'){
log_message('debug', 'Query returned ' . $num_rows . ' rows | SQL: ' . substr($this->sql, 0, 100));
}
if($num_rows == 0){
return FALSE;
}else{
return $query->result();
+11 -1
View File
@@ -119,7 +119,17 @@ class Groepen_model extends MY_Model{
AND GR.module = {$module}
GROUP BY GR.id, GR.naam, GR.niveau, GR.totaantal, GR.ondersteuning
ORDER BY niveau, naam, GR.id ";
return $this->get_query_result();
// Tijdelijk debug: ook op productie loggen
error_log("=== GETGROEPEN DEBUG ===");
error_log("orgid: $orgid, schooljaarnr: $schooljaarnr, module: $module");
error_log("SQL: " . $this->sql);
$result = $this->get_query_result();
error_log("Result: " . ($result === FALSE ? 'FALSE' : count($result) . ' rows'));
return $result;
}
function getgekopieerdegroepen($orgid, $schooljaarnr, $module){
$this->sql = "SELECT GR.id,