Posted by Jψrn Dahl-Stamnes on 12/16/59 11:57
JΓΈrn Dahl-Stamnes wrote:
> Kimmo Laine wrote:
>
>> "JΓΈrn Dahl-Stamnes" <newsmanDELETE@REMOVEdahl-stamnes.net> wrote in
>> message news:44fc09b5@news.broadpark.no...
>>> Hello,
>>>
>>> When doing queries from MySQL using the mysql client program, I get the
>>> time
>>> used to get the records at the end of the output.
>>>
>>> What is the best way of measuring the time used when doing a query from
>>> PHP?
>>
>>
>> $started = microtime();
>> query();
>> $stopped = microtime();
>>
>> $elapsed = $started - $stopped;
>> echo "query took $elapsed ms";
>
> Sounds easy, but it always give me a negative number below 0 (ie
> -0.15...). The same query takes 11 seconds in the mysql client.
>
> I'm using php 4.9.3.
Solved it. In php 4.9.3 the results from microtime is a bit different than
in 5.0.
Thanks for the tip.
--
JΓΈrn Dahl-Stamnes
http://www.dahl-stamnes.net/dahls/
Navigation:
[Reply to this message]
|