This is why FatalError is solved.

Source: Internet
Author: User
This is why FatalError: as soon as I add the following code to the webpage, loading will be slow and the Error prompt will appear: Fatalerror: Maximumexecutiontimeof30secondsexceededinE: \ xampp \ htdocs \ business \ lib \ function.
As soon as I add the following code to the webpage, loading will be slow and the following error will occur: 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);


I just want to get a shopping cart and generate an invoice ID at random, but the randomly generated IDs may be repeated. Therefore, first generate one randomly and then find it in the database for a certain period of time, if there is the same, it will be randomly regenerated into one, knowing that there are no duplicates.

I really don't know what the problem is. thank you! Take a look at it for me

------ Solution --------------------
$ Row = 1;
Do
{
......
$ Rows = mysql_num_rows ($ result );
.....
}
While ($ row! = 0 );

Endless loop! $ Row! = 0 conditions are always met

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.