ง่ายๆครับ
แต่ตัวนี้ผมเขียนให้เก็บแบบ ip ไม่ซ้ำกันด้วย ลองเอาไปปรับดูครับ
Code (PHP)
mysql_query ("localhost","root","556677");
mysql_select_db ("ip");
$ip = $_SERVER['REMOTE_ADDR'];
$date = date ('d-m-Y');
$time = date ('H:i:s');
$sqlselect = mysql_query ("select ip from ip where ip = '$ip' AND date = '$date'");
if (mysql_num_rows($sqlselect)>0){
$sqlup = mysql_query ("update ip set quantity = quantity+1,timelast = '$time' where ip = '$ip' AND date = '$date'");
} else {
$sqlinsert = mysql_query ("insert into ip values (0,'$ip','$date','$time','$time','1')") or die (mysql_error());
}