Home arrow MySQL arrow Page 3 - Completing a Search Engine with MySQL and PHP 5

Defining a simple web page generating class - MySQL

Building database-driven web sites is one of the most popular trends today in web site development. However, this approach implies that potential visitors must be provided with a straightforward mechanism that allows them to search through web site content. This three-part series walks you through the process of building an expandable search engine by using the combined functionality of MySQL and PHP 5.

  1. Completing a Search Engine with MySQL and PHP 5
  2. Listing the full source code of the original search application
  3. Defining a simple web page generating class
  4. Developing a fully-functional practical example
By: Alejandro Gervasio
Rating: starstarstarstarstar / 12
August 13, 2007

print this article



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:

class WebPage{
   private $title;
   public function __construct($title='MySQL-based Search
   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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Oracle Unveils MySQL 5.6
- MySQL Vulnerabilities Threaten Databases
- MySQL Cloud Options Expand with Google Cloud...
- MySQL 5.6 Prepped to Handle Demanding Web Use
- ScaleBase Service Virtualizes MySQL Databases
- Oracle Unveils MySQL Conversion Tools
- Akiban Opens Database Software for MySQL Use...
- Oracle Fixes MySQL Bug
- MySQL Databases Vulnerable to Password Hack
- MySQL: Overview of the ALTER TABLE Statement
- MySQL: How to Use the GRANT Statement
- MySQL: Creating, Listing, and Removing Datab...
- MySQL: Create, Show, and Describe Database T...
- MySQL Data and Table Types
- McAfee Releases Audit Plugin for MySQL Users

Developer Shed Affiliates


Dev Shed Tutorial Topics: