0

我在 PHP 中有一个 while 循环。

$result88452 = mysql_query("SELECT adid, ended FROM xzclf_ads WHERE ifended = 'no' AND verified = '1' AND enabled='1'");
while($row88452 = mysql_fetch_array($result88452))
  {
     $result88454 = mysql_query("SELECT adid FROM xzclf_ads WHERE ended <= NOW() AND verified = '1' AND enabled='1'");
     while($row88454 = mysql_fetch_array($result88454))
       {
echo "test ";
       } 
  }

我想知道循环完成了多少秒和毫秒。

谢谢

4

1 回答 1

1
$time_start = microtime_float();
$result88452 = mysqli_query($connection, "SELECT `adid`, `ended` FROM `xzclf_ads` WHERE `ifended` = 'no' AND `verified` = 1 AND `enabled` = 1;");
while($row88452 = mysqli_fetch_array($result88452)) {
   $result88454 = mysqli_query($connection, "SELECT `adid` FROM `xzclf_ads` WHERE `ended` <= NOW() AND `verified` = 1 AND `enabled` = 1;");
   while($row88454 = mysqli_fetch_array($result88454)) {
     echo "test ";
   } 
}
$time_end = microtime_float();
$time = $time_end - $time_start;
echo "Did the loop in ".$time." seconds\n";

注意我更改了代码以使用 MySQLi。

于 2013-06-16T16:11:13.537 回答