Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: PHP Counters Simple MySQL PHP Hit Counter Tutorial

A very simple hit counter that tracks visits per site. Also a basic introduction to Session Management.

Tutorial Details:

Simple MySQL PHP Hit Counter

Ok, so you've got a PHP and MySQL driven website. You don't want to install a complicated hit counter, but you do want to have a way to quickly view what kind of traffic your website is getting. Without making things too complicated and building a whole new database, you can do this easily without creating a large database just for website hits with numerous rows for each hit.

We want to have a method of counting the number "sessions" for the visits on your website. It is not practical to add 1 to your count for every page view each time the user clicks on a web page inside your site. Your counter would skyrocket rather quickly and it's sort of cheating your results.

Some webmasters like to see that counter climb quickly, but personally, I don't. I would rather know how many visitors are coming to my site, not how many page views are being displayed. Now that I have stated my opinions, I will show you how to build a simple hit counter.

For this hit counter we are going to use MySQL, PHP and PHP's awesome built in support for sessions. I want to stress the avoidance of cookies for something like this because you are going to be forcing this upon each user's browser and the world of Microsoft users are shifting towards Internet Explorer 6 which has created some great headaches for webmasters that like to use cookies.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
PHP Counters Simple MySQL PHP Hit Counter Tutorial

View Tutorial:
PHP Counters Simple MySQL PHP Hit Counter Tutorial

Related Tutorials:

Java Q&A - Java Still Open
Java Q&A - Java Still Open
 
When is a Singleton not a Singleton? - JavaWorld January 2001
When is a Singleton not a Singleton? - JavaWorld January 2001
 
Track wireless sessions with J2ME/MIDP
Track wireless sessions with J2ME/MIDP
 
Develop Java portlets
Develop Java portlets
 
Access Windows Performance Monitor counters from Java, Part 1
Access Windows Performance Monitor counters from Java, Part 1 Use a simple Java API to gather valuable performance statistics Summary Windows NT, 2000, 2003, and XP contain a utility called the Performance Monitor that provides a rich array of perform
 
Jeff Schmitt's JDBC Page
This tutorial assumes you are using the MySQL database and the GWE JDBC drivers. The host computer is triton.towson.edu.
 
FreeMarker FreeMarker 2.3.1 an open-source HTML template engine.
FreeMarker provides an easy way to get data from Java servlets into Web pages, and helps you keep graphic design separate from application logic. To use it, you encapsulate HTML in templates.
 
Backing Up and Restoring A MySQL Database
Backing Up and Restoring A MySQL Database Backing Up and Restoring A MySQL Database This tutorial explains the how to backup and restore the MySQL Database. Databases are used to store large amount of precious data and it becomes very important to
 
Writing a Custom Counter Component
MIDP 2.0 introduced the javax.microedition.lcdui.CustomItem class. As the name implies, a developer can now create custom UI components by extending the CustomItem class. This tech tip designs and implements a UI component for displaying a numeric counter
 
Welcome to Java Developers paradise!
Welcome to Java Developers paradise! T his site contains many quality Java, JSP, RMI, MySQL downloads, tutorials, source codes and links to other java resources. We have large number of links to the tutorials on java which will help you learn java
 

Linux Hosting Plans Proxima Web-Hosting Our basic hosting packages include support for a wide variety of web technologies, backed by instant account management with our Personal Control panel. With our guaranteed
 
First Step towards JDBC!
First Step towards JDBC! Welcome to our JDBC Section First Step towards JDBC This article introduce you with JDBC and shows you how to create a database application to access the databases. Accessing the Database from Servlet This article shows
 
We are providing Downloadable Version of Mandrake 10.1 Community Edition Linux CD's.
We are providing Downloadable Version of Mandrake 10.1 Community Edition Linux CD's. Mandrake 10.1 Community Edition Linux Now Available Mandrake 10.1 Community Edition CD's Mandrake 10.1 Community, released in Sept. 16, 2004 is an incremental
 
We are providing Downloadable Version of Mandrake 10.1 Official Edition Linux CD's.
We are providing Downloadable Version of Mandrake 10.1 Official Edition Linux CD's. Mandrake 10.1 Official Edition Linux Now Available Mandrake 10.1 Official Edition CD's Mandrakelinux 10.1 Official is a new-generation Linux operating system for
 
We are providing Downloadable Version of Mandrake 10.1 Power Pack Linux CD's.
We are providing Downloadable Version of Mandrake 10.1 Power Pack Linux CD's. Mandrake 10.1 Power Pack Linux Now Available Mandrake 10.1 Power Pack CD's Power Pack is a Linux system that will appeal to all advanced users. It's great for Office
 
Welcome to the MySQL Tutorials
Welcome to the MySQL Tutorials Welcome to the MySQL Tutorials Using MYSQL Database This lesson is intended to provide hands an experience with MYSQL database Backing Up and Restoring A MySQL Database In this lession you will learn how to take
 
Using MYSQL Database with JSP & Servlets.
Using MYSQL Database with JSP & Servlets. Using MYSQL Database with JSP & Servlets. MY SQL is a powerful RDBMS, which can handle large amount of data. And more interestingly it is free to use, except for some commercial use. you can download it
 
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page Connecting to MySQL database and retrieving and displaying data in JSP page This tutorial shows you how to connect to MySQL database and retrieve the data from the
 
What is Web Hosting
What is Web Hosting What is Web Hosting? What is Web Hosting? If you have a company and want web presence than you need a website. With the website any one from the world must be able to view your pages, images etc. Website is actually a
 
Integrating Java Open Single Sign-On in Pluto
This article shows how to integrate Java Open Single Sign-On in Apache\'s Pluto portlet container.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.