|
General Clean Up resets the |
Person Table |
Book Table |
Documentation |
||
|
Note - Create, Drop and Clean Up would be
hidden on a real life system. |
|||||
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 <
fclose ($fp); // Close the file
echo "</pre>\n"; // End of preformatted text
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
}
?>
|