<table width="600" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#336699"> <tr> <td bgcolor="#FFFFFF"> <h1 align="center"><?php echo $title; ?></h1> <?php echo $content; // when displaying an article show a link // to see the article list http://www.php-mysql-tutorial.com/ D:\Pc tools\Bina Laman web\Karya Cikguiti\PHP MySQL Tutorial.doc - 114 - if(isset($_GET['id'])) { ?> <p>&nbsp;</p> <p align="center"><a href="<?php echo $_SERVER['PHP_SEL F']; ?>">Article List</a></p> <?php } ?> </td> </tr> </table> </body> </html> If you click on an article link the script will fetch the article's title and content from the database, save it to $title and $content variable and print the HTML file . At the bottom of the page we place a code to show the link to the article list which is the file itself without any query string ( $_SERVER['PHP_SELF'] ) With this implementation each article request involve one database query. For a heavy load website with lots of articles using the above implementation can cause a very high amount of database - request. So we need a better cms solution to reduce the load. One feasible solution is to implement caching ( cache ) which load an article from the database only once when the article was first requested. The article is then saved to a cache directory as a regular HTML file. Subsequent request to the article will no longer involve any database request. The script just need to read the requested article from the cache d irectory. Example : article2.php Source code : article2.phps <?php include 'library/config.php';
<table width="600" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#336699"> <tr> <td bgcolor="#FFFFFF"> <h1 align="center"><?php echo $title; ?></h1> <?php echo $content; // when displaying an article show a link // to see the article list http://www.php-mysql-tutorial.com/ D:\Pc tools\Bina Laman web\Karya Cikguiti\PHP MySQL Tutorial.doc - 114 - if(isset($_GET['id'])) { ?> <p>&nbsp;</p> <p align="center"><a href="<?php echo $_SERVER['PHP_SEL F']; ?>">Article List</a></p> <?php } ?> </td> </tr> </table> </body> </html> If you click on an article link the script will fetch the article's title and content from the database, save it to $title and $content variable and print the HTML file . At the bottom of the page we place a code to show the link to the article list which is the file itself without any query string ( $_SERVER['PHP_SELF'] ) With this implementation each article request involve one database query. For a heavy load website with lots of articles using the above implementation can cause a very high amount of database - request. So we need a better cms solution to reduce the load. One feasible solution is to implement caching ( cache ) which load an article from the database only once when the article was first requested. The article is then saved to a cache directory as a regular HTML file. Subsequent request to the article will no longer involve any database request. The script just need to read the requested article from the cache d irectory. Example : article2.php Source code : article2.phps <?php include 'library/config.php';
PHP-MySQL-Tutorial.docx