PHP simple : PHP tutorial, MySQL tutorial
PHP Tutorial - Free PHP Script

Home | Tutorials | Php vs Node.Js | Web Tools

Easy Counter

Tutorials > Easy Counter

This counter made by very simple PHP code. This code shows the number of webpage's visitor by normal text and +1 everytime someone refresh this page.

This tutorial require 1 PHP file and 1 table of mySQL database.

  1. easy_counter.php
  2. Database "tutorial" and table "easy_counter" with 1 fields: visitor(Int, 11). You need to insert a first one record with "0".


Source Code
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
Counter :
// Connect database

// Update value in column "all_visitor" by +1.
mysql_query("update easy_counter set all_visitor=all_visitor+'1'");

// Select data from easy_counter and put them into $result.

$result=mysql_query("select * from easy_counter");

// Output all_visitor record.

echo $row['all_visitor'];

// Close database connection.


Put Ebay RSS Feeds onto your website
SEO Elite Software
Domain Dashboard CPanel & Seo Manager
Work at Home Ideas and Opportunities
Introduction & Get Start
Using Form
PHP Tags
PHP Variables
PHP Control Structures
Create Database & Table
Database Connection
Insert Record
Select Record
Update Record
Delete Record
[email protected]