On 7/15/07, Jon Baer <[EMAIL PROTECTED]> wrote:

mysql_stat()
http://us2.php.net/manual/en/function.mysql-stat.php

mysql_stat is good.  You can use a more direct status query if you
need more than that using "show status":
http://dev.mysql.com/doc/refman/5.1/en/show-status.html

<?php
        function dbg($var) {
                echo '<pre>' . print_r($var, 1) . '</pre>';
        }
        
        function get_mysql_full_status() {
                $aReturn = array();
                $oStatus = mysql_query('SHOW STATUS');
                while($aStatus = mysql_fetch_row($oStatus)) {
                        $aReturn[$aStatus[0]] = $aStatus[1];
                }
                
                return $aReturn;
        }

        $oConnection = mysql_connect('localhost', 'me', 'y0 [EMAIL 
PROTECTED]@');
        
        dbg(mysql_stat());
        dbg(get_mysql_full_status());
?>

However the fact that you want # of queries made in a single page might be
better to just do a query log dump and view it.

If you're using a class or function for db access, you could increment
a static or global var  each time you run the mysql_query function and
then in a destructor or at the end of the page you have your query
count.
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to