try this
mysql
CREATE TABLE `myVisitors`.`myVisits` (
`ip` BIGINT NOT NULL ,
`visits` INT UNSIGNED NOT NULL ,
`visitTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
UNIQUE (
`ip`
)
) ENGINE = MEMORY
php
<?php
$dbHost = 'localhost'; // database host
$dbName = 'myVisitors'; // database name
$dbUN = 'dbUN'; // database user name
$dbPW = 'dbPW'; // database password
$ip = ip2long($_SERVER['REMOTE_ADDR']);
$dbcon = mysql_pconnect($dbHost,$dbUN,$dbPW)
$sql = 'INSERT INTO ' . $dbName . '.myVisits SET ip=\'' . $ip . '\' ON DUPLICATE KEY visits=visits+1;';
$DBQ = mysql_query($sql);
echo (!$DBQ) ? "Error with adding IP. <br/> Error:" . mysql_error() : "Added IP";
mysql_close();
?>