|
|
|
|
|
|
| |
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 | |
| |
|
|