log
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user