What is best way to get the time it took for Php MySQL to process a Query?
I am doing this currently:
1- When the Query is POSTED I set:
$t1 = $_SERVER[‘REQUEST_TIME’];
2- When the Query is done, that is after:
mysql_query($sql_chk_url) or die(mysql_error());
I set:
$t2 = $_SERVER[‘REQUEST_TIME’];
However, $t1 $t2 are always the same even though it takes like 5 seconds for the page to come back vs 1 second. etc.
$_SERVER[‘REQUEST_TIME’]; will display the time in which the request was made, not the current time… You could run a difference between that and time() at the very end of your script for a full page process time. Use time() before and after your query for your query process time.