• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
paginating search results

#1
[eluser]bennyhill[/eluser]
I have a basic search function working for my database but it returns a lot of results I would like to paginate. I can't seem to figure how to hold onto what was entered into the search form for the CI pagination library to work since I'm not using GET variables. Should I store the search term in a cookie?

#2
[eluser]Burak Guzel[/eluser]
You can store it in session or cookies.

However, then there is a problem if the surfer wants to open multiple tabs with different searches. Then they can start overwriting each other. So you might want to create a unique id for each search, so multiple searches can be stored at the same time.

However, there is another issue. The person can't have a link to these search results (to bookmark it, or email it etc...), as the search parameter data would be temporary. If you want the links to keep working, you can store the search parameters permanently in a table, and assign a "query id". That's what I am doing in a project. So you can have url's this:

http://www.site.com/controller/method/qu...pagination

Sorry, all I provided is the logic and not the code. I hope it wasn't confusing.

#3
[eluser]bennyhill[/eluser]
The logic is all i'm looking for. Code is usually no problem. Thanks for the feedback. I wonder how other people DB search in CI?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.