SunQuest
 
       MySQL
  Home arrow MySQL arrow Page 3 - Completing a Search Engine with MySQL ...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
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? 
MYSQL

Completing a Search Engine with MySQL and PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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
     
    IBM developerWorks
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    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


       · Over the course of this final tutorial of the series, this MySQL/PHP 5 - based...
       · It's a decent simple search engine, but that's all really. It gets tougher when you...
       · Thank you for commenting on my PHP article. You’re correct regarding the simplicity...
       · Getting a grasp on classes in php is difficult for some, like myself, but your...
       · Thank you for the kind comments on my PHP article, and it's always good to know it's...
       · Hi, Thanks for the detailed tutorial. I began with confidence but I have...
       · Thank you for the comments on my PHP article. Now, concerning your question, the...
       · Hi Alejandro,Thank you for taking your time to reply. I read your entire...
       · Hi JSP,Thanks again for posting here. Now that you've created a "processform.php"...
       · Thanks Alejandro,That helps... WOW I wouldn't have guessed that, since I am no...
       · Hi JSP,Glad to know the search engine is working for you. Thanks again for the...
     

       

    MYSQL ARTICLES

    - 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...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...
    - Creating the Blog Script for a PHP/MySQL Blo...

    SlickEdit




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway