Paer Toernell
asked on
Access PHP session info from Mysql TRIGGER
Hello,
Trying from the Mysql side get PHP session info. My PHP is ....ancient. I'm writing a trigger and the trigger need to store some unique info about what PHP session that the trigger belongs to.
Regards Paer
Trying from the Mysql side get PHP session info. My PHP is ....ancient. I'm writing a trigger and the trigger need to store some unique info about what PHP session that the trigger belongs to.
Regards Paer
ASKER
Hello,
I'm trying to create a uncoupled log function. So that all insert, updates an deletes will be logged by a stored procedure initiated by a trigger. Without having to change the PHP code at all or minimal. Problem is I need something unique to identify the PHP session that initiated the Mysql operation. Perhaps an alternative solution is to get the Apache session?
I'm trying to create a uncoupled log function. So that all insert, updates an deletes will be logged by a stored procedure initiated by a trigger. Without having to change the PHP code at all or minimal. Problem is I need something unique to identify the PHP session that initiated the Mysql operation. Perhaps an alternative solution is to get the Apache session?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is no way to do that unless you pass php's session id to mysql in the php code... or rather the client's address.
It may proove way simpler to track calls directly in apache's or php's logs, or possibly create a dedicated log within the app
It may proove way simpler to track calls directly in apache's or php's logs, or possibly create a dedicated log within the app
ASKER
Chris, i lake that, probably my solution. But should not the variable have two @ to make it a session variable?
Regards Pär
Regards Pär
Hi,
You need to use the single @.
In MySQL there are actually 2 kinds of session variables - user defined and system defined. User defined uses a single @ , whereas system defined uses a double @@. You're creating a user-defined variable, hence the single @
You need to use the single @.
In MySQL there are actually 2 kinds of session variables - user defined and system defined. User defined uses a single @ , whereas system defined uses a double @@. You're creating a user-defined variable, hence the single @
ASKER
Thanx everyone.
Maybe explain a little more about what you're aiming for and we can try and offer an alternative solution