Solved

How to show a loading icon during a long query of a DB?

Posted on 2010-11-24
5
573 Views
Last Modified: 2012-05-10
Experts,

I have an sql query that takes some time to execute due to the size of the database and complexity of the query.  Is there anyway to show a loading graphic while this query is doing it's thing?

Cheers!

EVM
0
Comment
Question by:evibesmusic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Accepted Solution

by:
Vampireofdarkness earned 167 total points
ID: 34208424
As far as I am aware there is not via PHP. You could, however, use AJAX to execute the query and return a JSON/XML confirmation when it has succeeded and show a loading graphic that way.

jQuery (jquery.com), a popular JS library, has some very easy to use AJAX functions with customisable start (when ajax starts) and completion (when the ajax request is completed) functions -- ie, when AJAX starts, display a loading graphic and when it stops you hide the graphic.

Obviously with this method your page needs to load in order to start the AJAX request and you'll need to verify the success/failure based on the JSON/XML response.
0
 
LVL 2

Assisted Solution

by:marceloOrigoni
marceloOrigoni earned 167 total points
ID: 34212471
You must use a javascript library, I use mootools, you just need to add a onRequest and oncomplete event, to an HTML Request.

http://www.mootools.net/docs/core/Request/Request.HTML

Marcelo
0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 34213076
Google "jQuery Progress Bar" and you may find some good stuff.  You might also consider using just a little bit of CSS to style the "loading" message.  When the page completes, you could hide the message with a bit of JavaScript to modify the CSS.
0
 

Author Comment

by:evibesmusic
ID: 34261928
@All:

Thanks for your input...I am checking into each of the methods suggested above.  This question has not been abandoned.

Thanks.
EVM
0
 

Author Comment

by:evibesmusic
ID: 34320667
@All:

I am currently using Prototype to handle my ajax requests.  I was able to use Prototype to do what I needed to do.

Thank you for your suggestions, I am sure that each of them are viable in there own ways.

Points to all.  Cheers!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question