AaronV wrote:
I'd like to get the time it took a query to execute.
OK, so you can run microtime() before executing the query,
then again after executing the query, compute the difference,
and output the result.
The following example is based on code snippet given at
http://www.php.net/microtime:
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
$result = mysql_query('Your query here');
$time_end = microtime_float();
$time = $time_end - $time_start;
echo "The query took $time seconds";
Cheers,
NC