我在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 ";
}
}
我想了解循环完成的秒数和毫秒数。
由于
答案 0 :(得分: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。