Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 29th January 2010, 15:35
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,034
Thanks: 265
Thanked 152 Times in 132 Posts
Default MySQL / Paging and search results

At the moment I'm adding a search option to one of my projects.
The search is working great, but sometimes giving too much results back to fit on one page.

I know how to do a paging on results from the MySQL (page 1, page 2 etc..), but how do you do this on a search result?

I see that the HowtoForge forum does this by using a "searchid=xxxxx".
Whats stored in the searchid? Is this the search terms that the user used for the search?
Also.. Is the searchid stored in a MySQL or in a session?
__________________
Never execute code written on a Friday or a Monday.
Reply With Quote
Sponsored Links
  #2  
Old 30th January 2010, 16:25
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

I can't say for sure, but I guess it's stored in a session.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
edge (30th January 2010)
  #3  
Old 30th January 2010, 17:07
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,034
Thanks: 265
Thanked 152 Times in 132 Posts
Default

Thats how I'm doing it at the moment.

The problem is (I think) that "hackers" can inject stuff into a session, and that way inject into the MySQL. (I might be over paranoid)
__________________
Never execute code written on a Friday or a Monday.
Reply With Quote
  #4  
Old 23rd February 2010, 02:38
badben badben is offline
Senior Member
 
Join Date: Oct 2005
Location: Lancashire, UK
Posts: 103
Thanks: 0
Thanked 2 Times in 2 Posts
 
Default

I think the best way would be to store the search terms in the session.

If you validate the fields correctly each time, before you search, even if your session data is tainted there shouldn't be a problem.

Then you can treat it like any other pagination.
__________________
Web Developer
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:37.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.