Progress display in PHP loop and "suspended animation"

Source: Internet
Author: User
Tags add time
In theory, the program should run 500 times before showing success, but basically only run a 10 cretin page to start all white (while the page loaded in the flag has disappeared), no longer continue to execute the program down
How to solve this problem, thank you

In addition, the progress aspect does not know how to deal with. Thanks again

  ";}} echo "OK";? >

Reply to discussion (solution)

3 seconds x500= how long?

It's not dead.

3 seconds x500= how long?
No run time set, not dead.

Nnd,csdn give me 500 and let me send one more time ...

It's too long to run, and you're resting for 3 seconds.

Originally is a collection and write the database program, here just want to express approximate meaning code less easy to see


The following are the main contents of my original program

 $_post["Appoauthkey"], "user" =>$_post["user", "PW" =>$_post["PW"], "Appoauthid" =&gt ; $_post["Appoauthid"], "Accesstoken" =>$_post["Accesstoken"], "Appoauthkey" =>$_post["Appoauthke        Y "]," Lirun "=>$_post[" Lirun "," UIn "=>$_post[" UIn "]);        $db->row_update ("config", $data, "id=1");        if ($db->get_errno ()) {Alert_back ("Setup failed!");        }else{Alert_back ("Set success!");    }} $conf = $db->row_query_one ("select * from config where id=1"); $data = $db->row_query ("SELECT * from Data"), if ($act = = "Scan") {//$db->row_delete ("Data", ""); $itemState = $_post[ ' ItemState '];//commodity status $pagesize = GetPageSize ($itemState);//Product page for ($i =1; $i <= $PageSize; $i + +) {$htm = GetItemList ($ ItemState, $i); $xml = simplexml_load_string ($htm); $item = $xml->itemlist->item; $itemName = $item->itemname;$ ItemName = Iconv (' utf-8 ', ' gb2312 ', $itemName); $itemState = $item->itemstate; $itemCode = $item->itemcode; $itemPrice = $item->itemprice; $db->row_insert ("Data", Array ("Proname" =>$ ItemName, "Item" = $itemCode, "price" = $itemPrice, "itemState" + $itemState, "Add_time" and "$time");//Progress Information Pagesize}alert_back ("Scan ended, total number of messages: {$PageSize}!");}? ><title>Price and Inventory management system</title>
 Log Off Login

Pat platform-Price and Inventory management system

Commodity Management

Product information Management (total information)
$val) {echo ' '; $ii ++;//if ($ii >2) break;}? >
Id Product Name Item Price State Add Time Update Time Operation
'. $val [' id ']. ' '. $val [' Proname ']. " ". $val [' item ']. ' '. $val [' Price ']. ' '. $status _str[$val [' itemState ']. ' '. Date ("Y-m-d h:i:s", $val [' Add_time ']). ' '. Date ("Y-m-d h:i:s", $val [' Up_time ']). ' Delete


Added this program to run the end smoothly (longer time)

But this progress shows as if it had to run to the end to show it together ...

PHP is one time to calculate the output, even if the same side as the CLI to calculate the side output, but also to constantly brush the screen to achieve the progress bar effect
Progress in the client display, you think PHP will be in the server-side computing--Client display--server-side computing-client display-> Is that so?

If you want to do this, you have to take the loop apart, the client receives the first data, and then Ajax sends a next request to the server, PHP computes the next, sends the result to the client, and the client then Ajax ...

  • Related Article

    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: 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.