WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this Article to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES SUBMIT AN ARTICLE PRINT
Title : Static HTML Generation With PHP
Categories : PHP, HTML and PHP
phpfreaks.com
phpfreaks.com
Date : 2002-08-28
Grade : 0 of 5 (graded 0 times)
Viewed : 6467
Search : More Articles by phpfreaks.com
Action : Grade This Article
Tools : My Favotite Articles


  Submit your own code examples 
 


When you are running a large volume website that requires alot of mysql_query action you'll probably want to consider ways to reduce the impact of your server's performance. We can do this by generating static html pages from the pages that require all of these queries. By writing a few simple PHP scripts you can prepare to CRON your PHP driven site and have it automatically update for you at set intervals. Or you can have direct control over the updates via your web browser. This makes your website run alot faster and reduces your MySQL database queries dramatically.

Let's say that we have a tutorial index just like on phpfreaks.com. This tutorial index starts out by pulling queries for the following:

First Query:
Category ID (auto incremented number)
Category Title
Category Description

Second Query Based on cat_id from First Query:
Tutorial ID (auto incremented number)
Tutorial Title
Tutorial Caption
Tutorial Date
Tutorial Read Count
Tutorial Author ID

Third Query:
Get the Author's Name from the authors table where the author_id FROM second query matches the author's ID in the authors table. (We like to keep this dynamic in case the author changes his/her name later on.)

As you can see, the above queries are not that dramatic. In fact, it's quite a small query compared to some functions that you can get into using PHP and MySQL. Let's think about it this way. I can run this query every single time a reader clicks on our tutorial index page or I can generate a static HTML page that updates every 12 hours to update the information on the index page or I can just let the queries run every time the page is viewed. When you get about 2,000 page views of your index a day, that's about 6,000 queries right there. Why do that when we can do 6 queries a day?

Let's learn how to minimize the impact of your server on the next page.

Read More...









How To add paging (Pagination) with PHP and MySQL
Categories : PHP, Beginner Guides, Databases, MySQL, HTML and PHP
Uploading files to the server with PHP
Categories : PHP, File System, HTML and PHP, HTTP
Multicolumn Output from a Database with PHP
Categories : PHP, Databases, HTML and PHP, MySQL
Webstatistics with Redirectors
Categories : PHP, HTML, HTML and PHP
Making PHP Forms Object-Oriented
Categories : PHP, HTML and PHP, Object Oriented
Alternating row colors with PHP and mySQL
Categories : PHP, Databases, MySQL, HTML and PHP
tracking where and what on your site people are clicking
Categories : PHP, MySQL, HTML and PHP, HTML
Sending Form Data in EMail
Categories : PHP, Email, HTML and PHP
Previous and Next Links
Categories : PHP, HTML and PHP
Smarty Introduction
Categories : PHP, Smarty, Beginner Guides
PHP And Regular Expressions 101
Categories : PHP, Regexps
Function Based PHP
Categories : PHP, Functions
Building XML Trees with PEAR's XML_Tree Class
Categories : PHP, Pear, XML
Sending Mail Using Flash 4 and PHP
Categories : PHP, PHP options/info, Flash
File And Directory Manipulation In PHP (part 1)
Categories : PHP, Directories, Filesystem