user542603
user542603

Reputation:

Execute a function each time mysql_query is called. (PHP)

I've inherited some code which uses raw "mysql_query". No wrapper or anything. I want to get a log of every query sent to MySQL and the server guy has gone home, so I can't ask him to turn query logging on for a moment.

Is there any way of doing this?

Cheers.

Upvotes: 1

Views: 454

Answers (3)

regilero
regilero

Reputation: 30556

Upvotes: 0

ianbarker
ianbarker

Reputation: 1253

You might be able to do it with SET GLOBAL general_log = 'ON';

Upvotes: 1

dynamic
dynamic

Reputation: 48141

run:

mysql_query('SET GLOBAL general_log = 1;');

Upvotes: 1

Related Questions