Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying a loading bar and message whilst query is running?
    text
    copied!<p>Now that my woes with running the big .sql file within PHP (<a href="https://stackoverflow.com/questions/19790516/solved-using-a-php-session-variable-within-a-mysql-file-run-in-php/19809454#19809454">Using a PHP session variable within a MySQL file run in PHP</a>) are dealt with I want to display a loading bar (.gif) that I've made and a message displaying that the user data is being uploaded into the database because I don't want the user to think that their browser is not loading the page (since this process can take up to a couple of minutes depending on the file size).</p> <pre><code>&lt;img src='includes/loadingbar.gif' width='128' height='15' alt=''/&gt;&lt;/p&gt; Uploading your school data into the database, please wait. This process can take a while depending on your file size and connection. </code></pre> <p>Above is the image and the message I want to display while the query is running, but I can't seem to get past the white loading screen while it is updating the data. I've tried echo'ing the message after the query, before the query, as HTML code placed before and after the PHP command - but all I get is still this evil white screen. Every time the loading message doesn't show up until the query has finished (ironically), is there a way for it to show during the query in the format I'm currently using, or do I have to steer towards other programming languages? Many thanks!</p> <p>EDIT:</p> <p>I've tried to use a command before and after the php tags but it still doesn't operate until after the query has finished:</p> <pre><code>&lt;div id="message" div align="center"&gt;&lt;img src="includes/loadingbar.gif" width="128" height="15" alt=""/&gt; &lt;br /&gt; Please wait while your school data is being uploaded into the database. This can take a short while depending on your file size and connection. &lt;/div&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() {$('message').show(); }); &lt;/script&gt; &lt;?php session_start(); $page_title = 'SQLTest'; include ('includes/header.html'); require ('mldb_connect.php'); (etc...) </code></pre> <p>and at the end:</p> <pre><code> if ($populateresult) { $replace = $_SESSION['path'].$_SESSION['CentreNo'].'_'.$_SESSION['School'].'_' .date('dmY_His').'.txt' ; rename ($path, $replace) ; } ?&gt; &lt;script type="text/javascript"&gt; $(window).load(function() {$('message').hide();}); &lt;/script&gt; </code></pre> <p>What am I doing wrong with this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload