MySQL
  Home arrow MySQL arrow Page 3 - Completing a Search Engine 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

Completing a Search Engine with MySQL and PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 10
    2007-08-13


    Table of Contents:
  • Completing a Search Engine with MySQL and PHP 5
  • Listing the full source code of the original search application
  • Defining a simple web page generating class
  • Developing a fully-functional practical example

  • 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


    Completing a Search Engine with MySQL and PHP 5 - Defining a simple web page generating class
    ( Page 3 of 4 )

    As I stated in the prior section, the last task required to complete the development of this search application consists of building a simple yet effective web page generating class. This class will be responsible for creating the web documents required to display the results returned by a specified search query.

    Of course, the definition of this brand new PHP class is entirely optional in this case, since the respective database results can be also shown by using a procedural approach instead of the object-oriented one that I'm explaining here. Nevertheless, I'd like to show you the signature for this class, regardless of the method that you may want to use for displaying the search results.

    Given that, here's how this web page generating class looks:

    <?php
    class WebPage{
       private $title;
       public function __construct($title='MySQL-based Search
    Engine'){
         $this->title=$title;
       }
       public function displayHeader(){
         return '<html><head><title>'.$this->title.'</title><link
    href="default.css" rel="stylesheet" type="text/css" /></head>';
       }
       public function displayBody($content){
         return '<body>'.$content.'</body>';
       }
       public function displayFooter(){
         return '</html>';
       }
    }
    ?>

    Quite simple, right? As you can see, the signature for the above "WebPage" class doesn't bear too much discussion. It performs a few simple tasks, such as building the header, body and footer sections of a typical web document. Therefore, assuming that you won't have major problems understanding the way that this class works, it's time to move forward and develop a hands-on example, where you'll be able to see how this MySQL-driven search engine does its business.

    To learn how this practical example will be created, please click on the link below and keep reading.



     
     
    >>> 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 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek