Solved

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

Posted on 2010-11-24
5
569 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 108

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Phone Dialer 5 38
Runtime 3044 error 14 22
php connect() failed error 25 17
uploading image to a profile page 1 8
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now