看看下面的例子
<php
$ip = getenv(REMOTE_ADDR)
//echo $ip
$conn=mysql_connect(iproot****)
mysql_select_db(db$conn)
$sql=select *from counter where ip=\$ip\
$result=mysql_query($sql$conn)
$num=mysql_num_rows($result)
$count=mysql_query(select*from counter$conn)
$count=mysql_num_rows($count)
//echo $num
//echo $count
if($num==)
{
$sum=;
$count++;
$sql=insert into counter(ipsumcountdata)values($ip$count)
mysql_query($sql$conn)
mysql_close($conn)
//echo $count
}
else
{
$my=select sum from counter where ip=$ip
$bbbbbb=mysql_query($my) or die(mysql_error())
$row=mysql_fetch_Array($bbbbbb)
@$sum=$row[sum];
//echo $sum
$sum++;
$sql=update counter set sum=$sum where ip=$ip
mysql_query($sql)
mysql_close($conn)
}
$str_count=strval($count)
$str_count=Chop($str_count)
$count_len=strlen($str_count)
[] [] []