You are here: Re: PHP and MySQL « PHP Programming Language « IT news, forums, messages
Re: PHP and MySQL

Posted by Jψrn Dahl-Stamnes on 10/10/09 11:57

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.

--
JΓΈrn Dahl-Stamnes
http://www.dahl-stamnes.net/dahls/

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация