![]() |
Save query in pagination - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Save query in pagination (/showthread.php?tid=25611) |
Save query in pagination - El Forum - 12-17-2009 [eluser]nofearinc[/eluser] I have a search form that queries few tables and extracts a result set which is paginated. The problem is that when I click on another page, query gets clear (select *) and no search data is applied anymore. My search parameters are not persistent after the first request. How can I save the search criteria when switching through paginated table? P.S. Similar problem without replies: second link doesn't save the query Save query in pagination - El Forum - 12-17-2009 [eluser]Colin Williams[/eluser] Code? Save query in pagination - El Forum - 12-17-2009 [eluser]nofearinc[/eluser] It's 20 parameters from 6 joined tables, but the important part is that I generate query with $_POST parameters and logically they aren't persistent during paging. Code: function sell() { Save query in pagination - El Forum - 12-18-2009 [eluser]nofearinc[/eluser] A possible solution is saving input parameters into session and getting them from there every time I use pagination. The problem is when I'm going to flush the session? The best way is repopulating the $_POST every time I click next page, but I'm not sure how can I do request forwarding here. Any ideas? Save query in pagination - El Forum - 12-18-2009 [eluser]flaky[/eluser] Have you considered flashdata ? http://ellislab.com/codeigniter/user-guide/libraries/sessions.html Quote:Flashdata Save query in pagination - El Forum - 12-18-2009 [eluser]nofearinc[/eluser] It jumped out of my head, yes. That seems a good workaround of my problem, thanks. Going to test it this night. Save query in pagination - El Forum - 12-22-2009 [eluser]nofearinc[/eluser] Flashdata works just fine - before every page I send search parameters via session->set_flashdata(...) and retrieve them on load. One important detail only: If I try to directly use the session->flashdata() elements, I have strange caching for the first page load and it gets OK on refresh. I inspected it with the profiler and parameters haven't been sent to the query at all. Instead of refreshing, I assigned the flashdata() parameters to variables and that thing did the stuff. Thanks for helping! |