这是为什么 fatal error
我只要一加入以下代码 网页加载就很慢 然后就会出现这个错误提示: fatal error: maximum execution time of 30 seconds exceeded in e:\xampp\htdocs\business\lib\functions.php on line 13
php code$rand_invoice_id=rand(0000,9999);$current_time=date(y-m-d h:i:s);$current_time_start=date(y-m-d). .07:00:00;$tomorrow_time_start=date(y-m-d, strtotime('+1 day')). .07:00:00;$yesterday_time_start=date(y-m-d, strtotime('-1 day')). .07:00:00;$row=1;do{ $query=select * from cart where (invoice_id='$rand_invoice_id') and (order_time between '$current_time_start' and '$tomorrow_time_start'); $result=querymysql($query); $rows=mysql_num_rows($result); if($rows != 0) { $rand_invoice_id=rand(0000,9999); }}while($row!=0);
我只是想弄一个购物车,随机生成invoice id,但是随机生成的可能会重复,所以先随机生成一个,然后在数据库里一定时间范围内找,如果有一样的就重新随机再生成一个,知道没有重复为止。
我实在不知是哪有问题了,谢谢各位!替我看看吧
------解决方案--------------------
$row=1;
do
{
......
$rows=mysql_num_rows($result);
.....
}
while($row!=0);
死循环!$row!=0 条件永远满足