Page 1 of 1

Save Last Query

Posted: Tue Jul 25, 2006 4:59 am
by shiznatix
I have a search thing but I want registered users to be able to 'save their search' so they can sign in later and re-run that search without filling out a massive forum each time.

What I am doing now is whenever they run a search it saves the sql in a session then gives a link saying 'remember this search' and when you follow that it saved the sql in a database.

I am not sure I like this way of doing it because they could just run a search and then go to another section of the page then type in the SaveSearch.php and it will save the last search they did.

Although this is not really horrible it does give the user the ability to control the site in a way i don't want them to.

So my question is: what would be the best way to have a 'save this search' feature?

Posted: Tue Jul 25, 2006 5:03 am
by Benjamin
I store it (the search query) in the database before it gets executed the first time. Anytime they visit the results page, if no data is posted, it pulls the last query they made back out of the database.