Volatil3
Volatil3

Reputation: 14978

Finding the source of query in General Log

We use a similar query in our different code base modules and at times it gets difficult to check in General/Slow Query Log to find out the page where it got executed.

Is there anyway to pass some info to server while executing query?

Upvotes: 0

Views: 222

Answers (1)

Doug Kress
Doug Kress

Reputation: 3537

You can put a comment in your queries:

$sql = "-- Called from myfile.php:
    SELECT * from table;";
$res = mysql_query($sql);

The comment will be considered part of the statement and logged along with the query itself.

Upvotes: 1

Related Questions