Hi,

> at the mysql prompt i can get the exact time taken to run each query.
> how can i display this time in an HTML page via PHP. is there a function
> which gives me this time

Unfortunately, no, there isn't a built-in function to do this. So, you'll
have to resort to some DIY. But, it's quite easy...

Something like this should do the trick:

<?php
// Record start time.
$start = doubleval(microtime());

// Do your MySQL query here...

// Record the end time and print duration.
$end = doubleval(microtime());
echo "Query took " . strval($end - $start) . " seconds!";
?>

I'm not exactly sure whether doubleval() will convert microtime()'s "123456
450" return string value into a number like 123456.450, but I seem to
remember it does. If not, you'll have to settle for a resolution of only
whole seconds, by using time() instead.

Regards,

------------------------------------------------
Basil Hussain ([EMAIL PROTECTED])


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to