I have an overflow memory usage problem and I need to scan all my scripts.
My question is how can I show a list of running mysql queries in php?
If the problem is on MySQL site this could help a lot:
mysql_query('show processlist');
It should return all queries waiting for processing. I usually use it directly from mysql console where I don't have to format the output.
You can rename the original mysql_query function and write your own containing some additional logging/inspecting code to see what is going wrong with your queries:
rename_function('mysql_query', 'mysql_query_original');
override_function('mysql_query', '$query', 'return mysql_query_override($query);');
function mysql_query_override($query){
    echo "Query started";         // Add some more sensible information here
    $result = mysql_query_original($query);  
    echo "Query ended";           // Add some more sensible information here
    return $result;
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With