Forum Moderators: coopster
=================================
<?
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec*1000);
}
$time=getmicrotime();
echo "Page was generated in ".sprintf("%01.7f",((getmicrotime()-$time)/1000))." seconds.";
?>
================================
I would run a counter in my database abstraction layer that would increment a static variable [us3.php.net] or session variable by one for every query sent.
Otherwise, if I just wanted to know for my own benefit, I would simply run the xdebug profiler and it would return the number of times my query function in my abstraction layer was called.
Both of these, of course, depend on having a DB abstraction layer in place. I don't know how you would do it otherwise.
If you use a pre-made abstraction layer like the one from PEAR or something, they may have a built-in variable.