okay so I got a db setup to record visitors IP's, im trying to figure out how to add how many times they visit like if IP: 127.0.0.1
comes 3 times it would say 3, sounds simple but there in a db row so id be something like:
Code: Select all
<?PHP
$result = mysql_query("SELECT * FROM logs");
while($row=mysql_fetch_assoc($result)) {
$ips = $row['ip'];
}
print_r($ips);
?>
I have been working for like an hour trying to figure out how to add these up im really not sure, I was thinking the IP could be the variable and the number of hits could be what it equals or something:
Code: Select all
<?PHP
$result = mysql_query("SELECT * FROM logs");
while($row=mysql_fetch_assoc($result)) {
if($$row['ip']=='') {
$$row['ip']=1;
}
else {
$$row['ip']++;
}
}
?>
I read somewhere you could do that, although I havnt tested it, but even if id did work I wouldnt know all the variable names so yea any help would be great.