Page 1 of 1

PLEASE WAIT MESSAGE

Posted: Fri Nov 24, 2006 10:01 am
by savri
Hi:

I'm looking for ideas about having a "please wait image" show up in my result page for a specified amount of time.

Basically I want to have my sponsor's ads display for several seconds before I show the requested information ... which is an image from our database.

The PHP code creates a table with a Search Results Display Cell in the middle of the table.. the other cells are ads.

I would like to display the "Please wait!" message in the center cell.. (preferably an animated image)
then let the ads show up and after 5 or so seconds.. replace the Please wait message with the image from their search request.

So to recap... I want to delay the search result to let the advertisers have more show time... and then TA DA.. the results of the search displays.

I'm using a mysql database. I execute php code to generate the results table from an html form that gets the details of the user's request.

I want to avoid any JAVA if I can. but I'll consider any suggestion.

Thanks

Posted: Fri Nov 24, 2006 10:05 am
by skruby
That sounds like a job for Javascript.


First: display the ad
setTimeout(5 secs) then toggle() the ad and show your results

Posted: Fri Nov 24, 2006 10:13 am
by savri
I'm not very slick with java and want to avoid blockers!

Posted: Fri Nov 24, 2006 10:19 am
by Jenk

Code: Select all

<meta http-equiv="refresh" content="10;url=http://www.yourdomain.com/">

Posted: Fri Nov 24, 2006 10:26 am
by savri
Are you suggesting that I first generate my results with a page that has the refresh in it and then regenerate it with the actual results?

If so I'm not sure how the variables are passed to the actual request through the refress process? Or am I not getting your suggestion at all?

Thanks

Posted: Fri Nov 24, 2006 8:49 pm
by Christopher
You could generate the results in a <div> that is not visible, and put the advert in a visible <div>. The have Javascript swap the visiblity after a specified time.

Posted: Mon Nov 27, 2006 5:38 am
by Mordred
arborint wrote:You could generate the results in a <div> that is not visible, and put the advert in a visible <div>. The have Javascript swap the visiblity after a specified time.
Better yet, make the results in a visible div and the ad in a hidden one, make the javascript flip them twice. That way users with no javascript will be able to see the results. Or, show both by default, let javascript hide and re-show the results, that way the non-js user will see both the ad and the results.

Posted: Thu Nov 30, 2006 1:23 pm
by Hurreman
Could be a bit off-topic, but for those slow-running sql statements (or any other heavy function you might want to run), you can have a separate loading-screen to fetch all results, save them into session, and then redirect the user to another page after the sql statement is done running.

I didn't test the code below, and my apologies for any eventual syntax errors. I've been kicking around with ASP at my new job for a couple of weeks, and it's starting to get noticeable on my php-code :oops:

Code: Select all

<?php
	session_start();
	// Print a little loading message, animated gif/flash etc..
	echo '<p>Please wait...</p>';
	// Flush it out to the page
	ob_flush();
	flush();
	
	// connect to a database etc..
	$conn = mysql_connect('...');
	mysql_select('...');
	$rs = mysql_query('...');

	// Temporary array to hold all our results
	$results = array();
	$i = 0;

	// Dump all results into the temp array...
	while($row == mysql_fetch_array($rs))
	{
		$results[$i] = $row['yourcolumn'];
		$i++;
	}
	
	// and throw it into a session which we can access on the next page
	$_SESSION['results'] = $results;
	
	// And send the user to the page where the results will be shown (loaded from, for example, a session as above)
	// document.location.replace is used to prevent the user from using the browser back-button to end up at the loading screen again.
	echo '<script type="text/javascript">document.location.replace(\'show_results.php\');</script>';

	// flush again
	flush();
	ob_flush();
?>