What's new

Welcome to xCrud Community - Data Management and extended PHP CRUD

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

SOLVED Logging not log User

pierluisdj

New member
Joined
Nov 9, 2022
Messages
13
Reaction score
0
Points
1
Location
Italy
Hi,
when the set_logging is true, the query not update the column 'updated_by'.
How i can remediate?
Tnks in advance
 

pierluisdj

New member
Joined
Nov 9, 2022
Messages
13
Reaction score
0
Points
1
Location
Italy
SOLUTION:

mod file
xcrud.php

search
$db->query('INSERT INTO `logs` (record_id,action,table_name,data) VALUES ("' . $ins_id . '","INSERT","' . $this->table . '","' . $q_log . '")');
replace with
$db->query('INSERT INTO `logs` (record_id,action,updated_by,table_name,data) VALUES ("' . $ins_id . '","INSERT","' .$_SESSION['user_id'].'","' . $this->table . '","' . $q_log . '")');

search
$db->query('INSERT INTO `logs` (record_id,action,table_name,data,old_record) VALUES (' . $db->escape($primary) . ',"UPDATE","' . $this->table . '","' . $q_log . '","' . $row_log_json . '")');
replace with
$db->query('INSERT INTO `logs` (record_id,action,updated_by,table_name,data,old_record) VALUES (' . $db->escape($primary) . ',"UPDATE","' .$_SESSION['user_id'].'","' . $this->table . '","' . $q_log . '","' . $row_log_json . '")');

search
$db->query('INSERT INTO `logs` (record_id,action,table_name,data,old_record) VALUES (' . $db->escape($this->primary_val) . ',"DELETE","' . $this->table . '","' . $q_log . '","' . $row_log_json . '")');
replace with
$db->query('INSERT INTO `logs` (record_id,action,updated_by,table_name,data,old_record) VALUES (' . $db->escape($this->primary_val) . ',"DELETE","' .$_SESSION['user_id']. '","' . $this->table . '","' . $q_log . '","' . $row_log_json . '")');
 
Top Bottom