Solved

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

Posted on 2010-11-24
5
572 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
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 109

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 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