CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    13

    Display “Complete” div when reaches a line or a variable in PHP/HTML code

    I have a large MYSQL / PHP in a while loop report being run and in many cases the report times out due to the large amount of data being calculated.

    Is there a way to make have a div displaying "Processing" when the while loops is calculating and if the report is completed , a div "complete" is displayed.

    For example: The calculation are not complete because the variable $totals are not displayed. It is only when $Total is a rational value then "Completed" is displayed.

    Many Thanks in advance!



    PHP Code:
    <?php 
        session_start
    (); 
    ?> 
    <html> 
    <body id="dt_example"> 
    <div "Processing"> 
    <?php 
        
    while($noticia mysql_fetch_array($query)) { // Very long mysql query , query usually times out in this loop. Div "Processing" shown 
            
    $Total +=$subtotal
        } 

        echo 
    "Totals: ".$Total//when this is executed , the report is succesful and div "Completed " is displayed 
        
    echo "<div Completed>"

    ?></tbody></table></div> 
    </body> 
    </html>
    Last edited by PeejAvery; May 21st, 2015 at 02:52 PM. Reason: Added code tags

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Display “Complete” div when reaches a line or a variable in PHP/HTML code

    If your query times out either (1) your query string is bloated causing overwork, (2) you have a very bad database structure, or (3) you are working with databases way too large for your server architecture.

    If you don't fix either of those first three issues, then the rest really isn't going to help.

    As for PHP processing, remember that it is server-side. The only way to communicate back to the client is to finish the script. Hence the reason why AJAX was created.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured