Jump to content

Recommended Posts

I'm trying to create my own search engine for my website with what others post and I'm having problems creating multiple pages when the user limits the search to specific number of results. What I'm thinking of trying to do and I can't think of any other way for me to be able to do this is create a cookie with all the IDs that have been displayed and all the IDs in total and that cookie will be unset when they've searched a new query.

 

For instance they searched for automobile and there's a total of 20 results, they limit the search to 5 per page so as it loops through the MySQL database to get all 20 results it'll put those 20 results' IDs into a cookie as a string and then it'll put the 5 results that showed on the page into another cookie as a string. When the user clicks the next page it'll check to see if there's a cookie named usedID and if so it'll search through that cookie string using strstr() while looping through MySQL and if a MySQL id turns up that strstr() finds in usedID it won't display and it'll do that for all the pages of results until all the IDs are in usedID then it won't display a Next Page -->. Is this the correct way? I'm not going to be using Sessions. How are most dynamic search engines like this programmed? Any help would be appreciated. Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.