This is to create database
CREATE TABLE `xxx`.`track`(`id_stat` smallint(6) unsigned NOT NULL auto_increment,
`v_ip` varchar(15) collate utf8_unicode_ci NOT NULL,
`v_time` datetime NOT NULL default '0000-00-00 00:00:00',
`v_ref` varchar(200) collate utf8_unicode_ci NOT NULL,
`v_agent` varchar(100) collate utf8_unicode_ci NOT NULL,
`v_url` varchar(100) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id_stat`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;
and this is php code but is not working . kindly tell me what mistake i am doing here
<?php
$stsip = $_SERVER['REMOTE_ADDR'];
$stagent = $_SERVER['HTTP_USER_AGENT'];
$sturl = $_SERVER['REQUEST_URL'];
$stref = $_SERVER['HTTP_REFERER'];
$stuser="abc";
$stpass = "thanks";
$sthost="localhost";
$stdb= "visitorsrecord";
$sttable="track";
$handle = mysql_connect("$sthost",$stuser,$stpass) or die("Connection Failure to Database");
mysql_select_db($stdb,$handle) or die ($stdb."Database not found.".$stuser);
mysql_query("insert into $sttable(v_time, v_ip, v_agent, v_url, v_ref) values(NOW(), '".$stsip."', '".$stagent."','".$sturl."', '".$stref."')");
mysql_close($handle);
?>
Now the code is working fine. but now I am facing problem is . if someone open the website then i am getting one entry in database but if he further opening then another entry is coming. but i want to record only unique ip address per day.