CodeIgniter Forums
How to log all modifications from the Model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to log all modifications from the Model (/showthread.php?tid=47050)



How to log all modifications from the Model - El Forum - 11-24-2011

[eluser]EricDele[/eluser]
Hi

I have a site where I want to log in a database table all modifications that users are doing from the site on the database.

For this I want to use a table like that :
Code:
CREATE TABLE TLOG
(
   snap        DATE,
   userid      VARCHAR2(16),
   action      VARCHAR2(16),
   classe      VARCHAR2(32),
   methode     VARCHAR2(32),
   info        VARCHAR2(256)
)

example : log in the TLOG table that user X change the number of banana in the cart.

I was searching for implemneting it in the model class constructor, so if I could retrieve all the datas I need I will be able to insert in my log the information, by the only things I retrieve are the controller and method name with the $this->router->fetch_class() and $this->router->fetch_method(), not the model methode name.

Anyone have an idea ?