If I do an audit trail using triggers in MySQL, and I use MySQL session variables to store the PHP variables I need to store, something like:
SET @user_id = $user_id
SET @user_ip = $user_ip_address
and then use that information in the trigger, will that work? Is that a good solution?
what I fear is that if multiple users are making queries at the same time the @user_id session variable could change before the trigger is executed and it would be stored in the database as if the other user made the changes.
Can it happen?