PHP and MySQL Library Tutorial

General
Site Root
Database Home
Conect to MySQL
MySQL_Login.php
nav.php
dump.php

Clean Up resets the
database to contain
a few sensible
records.

Download Tutorial

Database
Create
Drop

Person Table
Create
Drop

Insert
Delete
Update
Search
Date-Search

Row Dump
Better View 
Table View 
Form View

Book Table
Create
Drop

Insert
Delete
Update
Search




Table View 
Form View

Loan Table
Create
Drop

Insert
Delete

Search




Table View

Documentation
Data Requirements
User Interface Design
Entity Relationship Diagrams
Data Flow Diagrams
Data Dictionary
Implementation Notes
Table Designs
Goals, Testing and Appraisal

Note - Create, Drop and Clean Up would be hidden on a real life system.
Contact - nbauers at samphire dot demon dot co dot uk
Copyright © - You may use and reproduce this material in a "not for profit" setting.

dump.php

This file contains the PHP code needed to print out the source code of the tutorial pages.


Code Listing : dump.php

<?php
      // ===============================================================
      // ===== This function displays the HTML and PHP code on the =====
      // ===== web page specified in $fileName                     =====
      // ===============================================================
      function dump_page($fileName)  
      {
        echo "<hr>\n";
        echo "<table cellpadding=\"10\" cellspacing=\"0\" 
	      border=\"1\"  bgcolor=\"#FFFFCC\">\n";
        echo "<tr>\n";
        echo "<td>\n";
        echo "<h3>Code Listing : $fileName</h3>\n";
        echo "</td>\n";
        echo "</tr>\n";
        echo "<tr>\n";
        echo "<td>\n";
	
        echo "<pre>";                 // Echo preformatted text
        $fp = fopen($fileName, "r");  // Open file for reading ("r")
        while (!feof($fp))            // While not end of file
        {
          $in = fgets($fp, 4094);     // Fetch a line from the file intp $in
          echo htmlspecialchars($in); // Display the line with special charactetrs
        }                             // converted. eg < becomes &lt;
        fclose ($fp);                 // Close the file
        echo "</pre>\n";              // End of preformatted text
    
        echo "</td>\n";
        echo "</tr>\n";
        echo "</table>\n";
      }
?>