Results 1 to 4 of 4

Thread: Show Number of MySQL Queries

  1. #1
    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..!!

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    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);

  3. #3
    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

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    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.

Similar Threads

  1. Optimizing queries in MySQL
    By Caden Fernandes in forum Software Development
    Replies: 4
    Last Post: 05-03-2010, 07:14 PM
  2. How to Run MySQL Queries with PHP?
    By Rob Dizzle in forum Software Development
    Replies: 4
    Last Post: 05-02-2010, 05:40 AM
  3. How to manage Parameterized Queries in MySQL
    By Zeverto in forum Software Development
    Replies: 3
    Last Post: 24-09-2009, 03:23 PM
  4. MySql to show records which is not a value
    By Grundy in forum Software Development
    Replies: 3
    Last Post: 23-07-2009, 07:48 PM
  5. Need to have multiple where queries in MySQL query
    By Anti_Trend in forum Software Development
    Replies: 1
    Last Post: 03-07-2009, 10:17 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,631,076.36462 seconds with 17 queries