Results 1 to 4 of 4

Thread: [RESOLVED] Count MySQL queries

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Resolved [RESOLVED] Count MySQL queries

    Bonjour, is there a function to return the number of MySQL queries within a script?

    Cheers

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Count MySQL queries

    i dont know if this will help you or not:

    http://www.howtoforge.com/forums/arc...p/t-14294.html
    My usual boring signature: Something

  3. #3

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Count MySQL queries

    It does in a way, it tells me that it cannt easily be done, and that is fine

    Thanks Dylan, many happy return;

    ILMV

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] Count MySQL queries

    It's not hard, you just need to create a wrapper class and replace all mysql_query calls with that. The wrapper class can also be used to make a connection to the database and close the resource when you are done.
    PHP Code:
    $db = new DbMysql($username$password$database);
    $result $db->query('SELECT * FROM myTable;');

    // example PHP class - should be expanded for you needs
    class {
        private static 
    $queryCount 0;

        public function 
    __construct($username$password$database) {
         
        }

        public static function 
    getQueryCount() {
            return 
    self::$queryCount;
        }

        public  
    query($query) {
            ++
    self::$queryCount;
            return 
    mysql_query($query);
        }

    Also, have a look at the PHP 5 OOP links in my sig. I have done just this.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width