473,383 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Hide and Show message

Hi there

I'm not so hot on JavaScript so not sure if this can be done.
I have a PHP page that runs a MySQl query, while these queries
are running I would like to show a message saying 'Processing....'
once the query has finished running the message disappears.

I was thinking of showing then hiding a layer, but I don't know
how to say, show this message at a set point eg below the
select box on the screen
Brian

Jul 23 '05 #1
4 2829


Brian wrote:
Hi there

I'm not so hot on JavaScript so not sure if this can be done.
I have a PHP page that runs a MySQl query, while these queries
are running I would like to show a message saying 'Processing....'
once the query has finished running the message disappears.
Generally, the page won't be sent to the browser until all the
processing is finished anyway. You can try to send something to
the browser before the processing begins, using ob_flush() and
flush(), but there's no guarantee that it will appear on the
browser because of buffering that takes place both at the server
and the browser.

I was thinking of showing then hiding a layer, but I don't know
how to say, show this message at a set point eg below the
select box on the screen


There are a couple ways you could do that. You could either set
the style property to display:none and display:block to hide or
show the element that carries the message. Or you could just
change the innerHTML property of the element.

But neither will work in your case, because the PHP script that
generates the page probably won't appear until it's all finished
processing.

Jul 23 '05 #2
Jc
The root problem may very well be inefficient SQL query usage, which if
fixed, would negate the need for a progress message altogether. You may
want to spend some time optimizing your queries, or eliminating queries
completely - assuming you haven't done so already.

For example, rather than running a query that returns say, 1000 records
from table A, and then running a second query for each of those 1000
records against table B, it can be a lot more efficient to grab the
entire applicable contents of the tables you are working with via two
simple queries (select * from ). The resulting recordsets would then be
iterated through and the data stored in internal data structures within
PHP, and then operations on those native objects can be used to do your
data processing rather than making thousands of "expensive" calls to a
database.

You can even take this a step farther, and cache these local
representations of your data for a period of time, allowing the code to
process multiple requests without having to go out to the database each
time.

Granted, you have to write more code, but you are also avoiding taxing
your database and making your user(s) wait (not to mention increasing
the scalability of your application).
Brian wrote:
Hi there

I'm not so hot on JavaScript so not sure if this can be done.
I have a PHP page that runs a MySQl query, while these queries
are running I would like to show a message saying 'Processing....'
once the query has finished running the message disappears.

I was thinking of showing then hiding a layer, but I don't know
how to say, show this message at a set point eg below the
select box on the screen
Brian


Jul 23 '05 #3


Jc wrote:
The root problem may very well be inefficient SQL query usage, which if
fixed, would negate the need for a progress message altogether.
No, it would not. Whenever a program has to communicate with another
one
over a network, there is the possibility that the other one is out to
lunch, on vacation, under attack, etc...

It's generally good practice to display a "busy" message whenever an
operation could take some time, and to have a timeout function as well.
This isn't the easiest thing to do when a page submits a form with
itself
as the target, of course. But...
You may
want to spend some time optimizing your queries, or eliminating queries
completely - assuming you haven't done so already.


Sure. Of course. We should optimize everything always. And plan for
less
than optimum results.

Jul 23 '05 #4
Hi Guys

I have done it by showing and hiding a layer. The trouble is not
the statement, that is fine, the trouble is it has to look though
40,000 record and do a load of calculation, that's what's slowing it
down.

When the form is submitted (back to it's self ) I top of the page loads
OK, then it starts the SQl stuff, just before it I show the layer, once
it's finished it hides it.

Brian


"Razzbar" <gl***@potatoradio.f2s.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...


Jc wrote:
The root problem may very well be inefficient SQL query usage, which if
fixed, would negate the need for a progress message altogether.


No, it would not. Whenever a program has to communicate with another
one
over a network, there is the possibility that the other one is out to
lunch, on vacation, under attack, etc...

It's generally good practice to display a "busy" message whenever an
operation could take some time, and to have a timeout function as well.
This isn't the easiest thing to do when a page submits a form with
itself
as the target, of course. But...
You may
want to spend some time optimizing your queries, or eliminating queries
completely - assuming you haven't done so already.


Sure. Of course. We should optimize everything always. And plan for
less
than optimum results.

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Doug van Vianen | last post by:
Hi, I am using Choice to provide a dropdown menu in an Applet. I create the Choice and then need to hide it until it is needed and then show it. I use c.hide() and c.show() where 'c' is the...
13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
10
by: David | last post by:
Hi everyone, Hoping there are some .js/browser experts out there that can help with this weird problem. I have made a swap div routine and applied the events to menu buttons with a closer...
2
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
7
by: FP | last post by:
I'm new to Java Script. I'm displaying comments people have made. Below each persons' comment I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would display an empty text field...
13
by: jeff | last post by:
I am attempting to be able to show and hide a form called viewAllForm. I declared an instance of the form in a module. Public viewAllForm As New frmViewAll However I keep getting runtime errors...
5
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of...
1
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. ...
10
by: sara | last post by:
Hi - Is it possible to hide the detail section of a report at run time? I have a report that prints all details, with summary lines. The user would like the report ALSO with just summary lines....
6
by: Doogie | last post by:
Hi I have an img control I am trying to hide upon certain types of commands in my code behind. When to hide it is directly tied to a asp:dropdownlist control. So depending on what the user...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.