php - Log all MySQL transactions on a per user basis -


i have php application uses single database multiple users. user log on, id stored in session, , use application retrieve or update data in database.

for security/archival purposes, log every sql transaction on per user basis. note "user" not mysql user uses 1 user. how do this?

i operating centos 5.8, php 5.3.18, , mysql 5.5.

thanks

$sql = "update table set col = ?" $db->prepare($sql); //some params etc...  $filename = '/dir/logs/log-' . $_session['username'] . ''; $handle = fopen($filename, "wr"); $db->execute(); fwrite($handle, $sql); 

it's simple example, how use query either execution , writing in file, named user. well, used way maybe content of $sql before execution, think got idea.

p.s.: thx edit :)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -