Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82440

PostCreate, PostEdit and PostRemove logging to save on other database

$
0
0

I want to PostEdit to save logging on other database and no save to same database !

function logChange ($db, $action, $id, $values) {
            $db->insert('logs', array(
                'user'      => $_SESSION['user'],
                'action'          => $action,
                'values'       => json_encode($values),
                'row'         => $id,
                'date'         => date('d.m.Y')
            ));
}

...

->on('postCreate', function ($editor, $id, $values, $row) {
            logChange($editor->db(), 'create', $id, $values);
        })
        ->on('postEdit', function ($editor, $id, $values, $row) {
            logChange($editor->db(), 'edit', $id, $values);
        })
        ->on('postRemove', function ($editor, $id, $values) {
            logChange($editor->db(), 'delete', $id, $values);
        })
        ->process($_POST)
        ->json();

Please help me and thank you very much.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.


Viewing all articles
Browse latest Browse all 82440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>