Hello
I would like to know how we can show how many MySQL queries were run?
please let me know
thanks for any help..!!
Hello
I would like to know how we can show how many MySQL queries were run?
please let me know
thanks for any help..!!
You know what functions like mysql_query and mysql_fetch_array etc are the medium for php to communicate with mysql and there is no other way, according to my limited knowledge, to fetch data directly from mysql using php unless you use another function like
exec("execute mysql command from shell",$results);
print_r($results);
I add a one every time I create a query, so you should keep in mind this.You could also have a var configure
At the top $num_queries = 0;
Each query just add $num_queries = $num_queries +1;
It can make it dynamic
Then echo $num_queries;
The Dynamic Way
If you see the same code more than one and are finding it rather repetitive, you may need to begin looking at creating some functions. They can make the code much easier to read/debug/write/etc... Can't get much shorter than one function call.counting the queries is easy if you use a database abstraction layer. You can also count how long the queries take. In fact, it's required for any programmer to make sure you don't do something crass. I do it all the time.
Bookmarks