Jump to content


Photo

How do i do this ?


  • Please log in to reply
7 replies to this topic

#1 trevorb

trevorb
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 16 March 2006 - 10:41 PM

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


#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 16 March 2006 - 10:58 PM

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

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

good luck.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 fusionpixel

fusionpixel
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 16 March 2006 - 11:04 PM

have you considered re-designing your db? maybe it needs some tweeking.
Did you know there is a manual for PHP? [a href="http://" target="_blank"]http://www.php.net[/a]
Did you know there is a manual for mySQL? [a href="http://" target="_blank"]http://www.mysql.org[/a]

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 16 March 2006 - 11:33 PM

.. 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.
Legend has it that reading the manual never killed anyone.
My site

#5 trevorb

trevorb
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 16 March 2006 - 11:59 PM

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.


#6 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 17 March 2006 - 12:37 AM

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.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#7 trevorb

trevorb
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 March 2006 - 01:08 AM

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 ?


#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 March 2006 - 01:48 AM

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


and


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


<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>


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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users