Connecting Tech Pros Worldwide Help | Site Map

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

nao@vorsicht-scharf.de
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

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.location='".$place."';</script>\n";
?>
after the other code, it should redirect.

Closed Thread


Similar PHP bytes