Reputation: 515
In my case Mysqli php extension is used to access mysql server.
It is a WordPress site, but many plugins recently switching from using wpdb
wrapper because other plugins are trying to manipulate the queries via hooks.
I need to log the queries for selected users. I believe that can be achieved only by filtering and logging the queries using php.
Before or after calling mysqli_query()
is it possible to get the query in php?
P.S: I am looking for universal solution, so I can implement it in my plugin.
Upvotes: 3
Views: 89
Reputation: 157888
Nope, it's not possible with raw PHP.
You can always write a db wrapper of your own and use it in your plugin though. You are even encouraged to do so, as raw mysqli, being a thin wrapper over Mysql C API, is almost unusable as is and must be wrapped in a helper library anyway.
Upvotes: 2