reload a page after execution of a mysql-query in php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nao@vorsicht-scharf.de

    #1

    reload a page after execution of a mysql-query in php

    Hi all!

    I am aware that this question might involve Javascript and MySQL. So
    far I haven´t found a suitable solution in JavaScript ng´s - maybe
    becauese php-programmers are more likely to come across the following
    problem:

    A script on my page relays a quite complicated query to a MySQL-server
    with mysql_query(... ); The query works fine but takes very long - I
    usually have to wait for approx. 30 seconds before the query is
    returned from MySQL and the results displayed by php on a webpage.

    I´d rather have the results of the query written into a nice textfile
    and display a text like "Results are being retrieved" in stead of the
    actual results and have the page reloaded a f t e r the textfile has
    been updated. The newly loaded page then would obviously first check
    whether this very textfile has been updated or not and read out its
    contents in case it is has been updated less then let´s say two
    minutes ago.

    I hope I can make myself understood...:)

    My question is: what actual code (I am almost sure it must be
    JavaScript and not PHP) does PHP have to generate in order for the page
    to reload after the results are retrieved and stored in the textfile?
    Thank you in advance for hints, Nao

  • jblanch

    #2
    Re: reload a page after execution of a mysql-query in php

    Javascript Redirects:
    self.location=' place.php';
    window.location ='place.php';

    there are others, pick one and go with it.

    Might i suggest a pop-up warning the user of the slow process?
    But anyways, if you just put the
    <?php
    $place = "page_after.php "; // replace, duh.
    echo "<script>self.l ocation='".$pla ce."';</script>\n";
    ?>
    after the other code, it should redirect.

    Comment

    Working...