How to make modification records in a MySQL table (without using triggers)?

1

I would like to know if there is another technique of making record changes in the tables without going through triggers ?

    
asked by anonymous 21.12.2016 / 11:46

1 answer

0

André, good morning

If it is via some language, like PHP for example, you can create a log for example:

<?php


function gravaLog($text){

$data = date("d-m-y");
$hora = date("H:i:s");

$arquivo = $data.".txt";     

$texto = "[$hora] - $msg \n";

$arr = fopen("$arquivo", "a+b");
fwrite($aar, $texto);
fclose($aar);

}

?>

Then for each function that manipulates the bank you would call, for example:

function insereBanco($reg){
     //sua funcao
     gravaLog("O registro " . $reg . " foi inserido no banco")
}

function alteraBanco($reg){
     //sua funcao
     gravaLog("O registro " . $reg . " foi alterado no banco")
}
function deletaBanco($reg){
     //sua funcao
     gravaLog("O registro " . $reg . " foi excluido no banco")
}
    
21.12.2016 / 13:07