MySQL
  Home arrow MySQL arrow Page 4 - Paginating Result Sets for a Search Engine Built with MySQL and PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
MYSQL

Paginating Result Sets for a Search Engine Built with MySQL and PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2007-08-01


    Table of Contents:
  • Paginating Result Sets for a Search Engine Built with MySQL and PHP 5
  • Listing the full source code for the original search engine
  • Adding pagination capabilities to the initial search engine
  • Maintaining the value of a given search term across different web pages

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Paginating Result Sets for a Search Engine Built with MySQL and PHP 5 - Maintaining the value of a given search term across different web pages
    ( Page 4 of 4 )

    As I expressed in the section that you just read, the last step that I'm going to take for the moment will consist of building a basic session handling class. This class will come in useful for maintaining the value of a given search string across the different web pages generated by the page links that you learned before.

    With the session handling class, each time an user performs a search against one or more selected databases, the search terms will be kept when clicking on the page links. Quite simple, isn't it?

    That being said, here is the signature of this brand new session handling class: 

    class SessionHandler{
       public function __construct(){
         session_start();
       }
       public function setVariable($value='default',$varname='default'){
         $_SESSION[$varname]=$value;
       }
       public function getVariable($varname='default'){
         if(!$_SESSION[$varname]){
           return false;
         }
         return $_SESSION[$varname];
       }
       public function destroy(){
         session_start();
         session_unset();
         session_destroy();
       }
    }

    As you can see, the above session handler presents a few basic methods for registering and deregistering session variables, in addition to destroying a complete session. This class is the one that I'm going to use in conjunction with the others defined earlier to implement a fully functional searching application. However, the completion of this MySQL-driven search engine will be done in the last tutorial of the series.

    Final thoughts

    In this second article of the series I explained in detail how to add result pagination capabilities to the existing MySQL-based search engine by incorporating some basic methods into the "Result" class that was developed in the first tutorial. I also defined a brand new session handling class for maintaining the value of a given search string across different web pages.

    Thus, the next logical step will consist of putting all these classes to work together, in this way completing the development of this expandable search application. Naturally, this will be done in the last part of the series, so you don't have any excuses to miss it!



     
     
    >>> More MySQL Articles          >>> More By Alejandro Gervasio
     

       

    MYSQL ARTICLES

    - MySQL Security Tips
    - Designing a MySQL Database: Tips and Techniq...
    - The Three Most Important MySQL Queries
    - Null and Empty Strings
    - MySQL Server Tuning Tips and Tricks
    - MySQL Query Optimizations and Schema Design
    - MySQL Benchmarking Tools and Utilities
    - MySQL Benchmarking Concepts and Strategies
    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek