Hello
In a php script, I have a query to select a record from a database. I really want to know how long this query will take
So I want to print time stamp before and after this query (in miliseconds). However, php cannot print a timestamp value
Could you please help
regards
john
print timestamp
Moderator: General Moderators
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
microtime() is what you're afrer:
Code: Select all
$time_start = microtime(true);
// query here
MySQL_query("SELECT * FROM table WHERE `bob`='yourUncle'");
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "Query took $time seconds\n";- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Everah | Moved to PHP code.
If you haven't already clicked on the microtime() function link, you should. Right up toward the top of the page is an example of doing exactly what you want to do.
If you haven't already clicked on the microtime() function link, you should. Right up toward the top of the page is an example of doing exactly what you want to do.