3 Commits
Author SHA1 Message Date
Monique c8fc4767a1 log 2026-03-10 16:19:32 +01:00
Monique 44bc260061 full group by uitzetten 2026-03-10 16:11:52 +01:00
Monique 90b4f0d08e logging 2026-03-10 15:51:46 +01:00
2 changed files with 32 additions and 5 deletions
+19 -2
View File
@@ -13,9 +13,11 @@
class MY_Model extends CI_Model{
function __construct(){
parent::__construct();
// Disable ONLY_FULL_GROUP_BY for legacy queries
$this->db->query("SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))");
}
function get_record_by_id($id, $fieldname=FALSE, $row=TRUE){
@@ -74,7 +76,22 @@ class MY_Model extends CI_Model{
function get_query_result(){
$query = $this->db->query($this->sql);
if($query->num_rows()==0){
if($query === FALSE){
$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;
}
$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();
+13 -3
View File
@@ -117,9 +117,19 @@ class Groepen_model extends MY_Model{
AND GR.schooljaarnr = {$schooljaarnr}
AND GR.schooltype = 'R'
AND GR.module = {$module}
GROUP BY GR.id
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,
@@ -146,7 +156,7 @@ class Groepen_model extends MY_Model{
AND GR.schooljaarnr = {$schooljaarnr}
AND GR.schooltype = 'R'
AND GR.module = {$module}
GROUP BY GR.id
GROUP BY GR.id, GR.naam, GR.niveau, GR.totaantal
ORDER BY niveau, naam, GR.id ";
return $this->get_query_result();
}