Jump to content

Archived

This topic is now archived and is closed to further replies.

trevorb

How do i do this ?

Recommended Posts

Hi Gents,

Let me start off by saying im new to php.

On my website (php based) i have a search facility.
This search searches my database and returns back products that match the search criteria.
So the process is ...
1) submit the search
2) see the search results in the results page.

Now my database is getting bigger and the searches are becoming more complex making the results take longer to return.
This causes me a problem because sometimes users of my site think its crashed and either try and refresh or just leave the site.

What i want to do is place a holding page between the search page and the results page.
This holding page would maybe have like a egg timer on it so the users know something is happening and wont leave the site.

So my question is ...
How can i add a holding page that displays the results once they have been fully processed by the server ?
For example the process would now be ...
1) submit the search
2) display a holding page telling the user we are getting the data
3) remove the holding page and display the results

This is being done on a holiday site called teletextholidays.co.uk .... if you perform a holiday search you see this holding page for maybe 2/3 seconds. ???

How do i do this ? im totally lost.

Cheers

Share this post


Link to post
Share on other sites
Afther the user submits the request send them to a new page that will display an animated gif with the progress bar going up and down.

Then when there at that new page afther 2/3 secounds send them back to the listed listings.

All this can be done with this.

example

[code]
echo "<a href=\"whatever.php\"><br>redirecting...</a><p></td></tr></table><META HTTP-EQUIV=refresh CONTENT=1;url=whatever.php>"
[/code]

good luck.

Share this post


Link to post
Share on other sites
.. or have you considered redesigning your results display strategy?

For example, do a count(somefieldname) .. as the first query to quickly find the total number of matches, and follow that with a query to select a LIMITed number ore results. The 'holding page' doesn't really make a ot of sense. If Google and eBay can do mega searches with holding pages, I expect your site could too.

If we saw some of your code that would help focus the help.

Share this post


Link to post
Share on other sites
Hi Guys,

With regards to redesigning my database - this would be a massive operation ... i have admin areas that use it and stats programmes that use it .... it not really a option !

With the solution that 'redarrow' suggested ... this is fine ... but i want to be loading the results page as the animated gif is being displayed to the user ...

For example :
If i just redirect to the results page after 3 seconds - the result page still needs to be created with the data.

What im trying to acheive is that why im displaying a page with a animated gif the result page is being built and then when its built it some how tells the holding page (animated gif) that its ready and then the holding page displays the results.

I guess what im tring to explain is that ... the results page will display a animated gif + a message until the results are ready ... once the results are ready to be displayed we remove the animated gif + message and replace them with the processed results.

Share this post


Link to post
Share on other sites
I would suggest creating a temporary table from the "holding page" that has all of the information you want then redirecting to the list page which will simply list all the results stored in the temporary table and remove that table. This is the cleanest way I can think to do what you are asking. There are probably a lot of ways, but this is the best one I can think of at the moment. The problem with the logic behind it...people will still think that it must have malfunctioned after a certain amount of time even if it says, "Searching the database...". People don't like to wait so your best bet is to redesign the table or your search method to optimize load time. If you use AJAX or something like that to return the results in place of the "hold page" once they are ready it would be a lot better since it would not have a redirect in between showing the "hold page" and the results. I do like the idea, but load time is going to be your enemy no matter what you do. If it runs too long people generally are not going to wait.

Share this post


Link to post
Share on other sites
Thanks guys for all the advice !

If you have 5 minutes to spare please take a look at teletextholidays.co.uk
Then perform a holiday search .

You will see the process im trying build once you submit the search !

How are they doing it ?

Share this post


Link to post
Share on other sites
This is for the page that the user search for items ok.
[code]
<?
if($summit)
{
echo "<a href=\"whatever.php\"><br>redirecting...</a><p></td></tr></table><META HTTP-EQUIV=refresh CONTENT=1;url=newpage.php>"
}
?>
[/code]


and


This is for the page with the new animation gif and it will return in 10 sec ok to the search page.

[code]

<HTML>
<HEAD>
<META http-equiv="refresh" content="10;URL=http://newdomain.com">
<TITLE>What ever it is</TITLE>
</HEAD>
<body>
<img src="animation.gif"></img>
</body>
[/code]


I had a look at the website above and they are doing what i surgest ok, all they have done is use the above method and included there page background and banners and in the center a animated gif ok.

The reason it's got the whale factor is becouse you only get a slight glance at the animated page but looking the same as the main seach page making it all look like its all done there and then like flash but using javascript and php,

As i said the logos and back ground are the same as the first page and secound page so it all looks the same for that whale factor that you have had and want to do.

All the best redarrow.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.