Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Show Number of MySQL Queries

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 28-07-2009
Member
 
Join Date: Jan 2009
Posts: 44
Show Number of MySQL Queries
  

Hello

I would like to know how we can show how many MySQL queries were run?
please let me know

thanks for any help..!!

Reply With Quote
  #2  
Old 28-07-2009
Member
 
Join Date: May 2008
Posts: 2,007
Re: Show Number of MySQL Queries

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);
Reply With Quote
  #3  
Old 28-07-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: Show Number of MySQL Queries

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
Reply With Quote
  #4  
Old 28-07-2009
Member
 
Join Date: May 2008
Posts: 2,291
Re: Show Number of MySQL Queries

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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Show Number of MySQL Queries"
Thread Thread Starter Forum Replies Last Post
Optimizing queries in MySQL Caden Fernandes Software Development 4 05-03-2010 07:14 PM
How to Run MySQL Queries with PHP? Rob Dizzle Software Development 4 05-02-2010 05:40 AM
How to manage Parameterized Queries in MySQL Zeverto Software Development 3 24-09-2009 04:23 PM
MySql to show records which is not a value Grundy Software Development 3 23-07-2009 08:48 PM
Need to have multiple where queries in MySQL query Anti_Trend Software Development 1 03-07-2009 11:17 PM


All times are GMT +5.5. The time now is 05:53 AM.