< Buzzing or vibrating the login form using jquery Posted On May 15, 2012 : 0 comments << >> Simple div slideshow using jquery Posted On May 9, 2012 : 0 comments << >> Copy mysql column in varchar to type date Posted On May 3, 2012 : 0 comments << >> Enter only numbers inside a input field of a form using javascript Posted On May 1, 2012 : 0 comments << >> Slide in and out animate div vertically using jquery Posted On April 25, 2012 : 1 comment << >> Tag cloud using php, mysql and ajax with filter Posted On April 24, 2012 : 0 comments << >> Change webpage font color or background color from the user side using javascript Posted On April 19, 2012 : 0 comments << >> A single link that cycles through several webpage background color using javascript Posted On April 17, 2012 : 0 comments << >> Simple webpage redirection using perl script Posted On April 10, 2012 : 0 comments << >> Get ipaddress using perl script Posted On April 4, 2012 : 0 comments << >>

Simple Visitor Counter Using php

This Tutorial Has Been Viewed 8,740 Times.
VN:F [1.9.17_1161]
Rating: 7.6/10 (22 votes cast)

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

1. counter.php
2. Database “mypage” and table “counter” with 1 fields: visitor(Int, 11). You need to insert a first one record with “0″.

Counter.php
Source Code

< ?php
// For using session variables put this function on the top.
session_start();

// Connect database
mysql_connect("localhost","","");
mysql_select_db("mypage");

/* Check for session variable "visitor".
If not exist, update database and create this session by Session ID.*/
if(!session_is_registered("visitor")){
$visitor=session_id();
session_register("visitor");

// Update value in column "all_visitor" by +1.
mysql_query("update counter set visitors=visitors+'1'");
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Counter</title>
</head>
<body>
Counter :
< ?
// Select data from easy_counter and put them into $result.
$result=mysql_query("select * from counter");
$row=mysql_fetch_assoc($result);

// Output all_visitor record.
echo $row['visitors'];

// Close database connection.
mysql_close();
?>
</body>
</html>
VN:F [1.9.17_1161]
Rating: 7.6/10 (22 votes cast)

Simple Visitor Counter Using php, 7.6 out of 10 based on 22 ratings

Incoming search terms:





You will also be interested in ,

Tags: , ,

One Response

  1. adnan says:

    thank you very much….
    your good..

    VA:F [1.9.17_1161]
    Rating: 0.0/5 (0 votes cast)

Leave a Reply

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks