I am fairly new to coding in php and have come accross a bit of a problem which I think is very simple. I am trying to capture the IP address of anybody that visits my website and stores that in my database. The code is as follows, I am not even sure the code will work but I do get the following error Parse error: syntax error, unexpected T_INC on line 29 which I will highlight in the code:
$ip = $_SERVER['HTTP_CLIENT_IP'];
$query="SELECT * FROM ip";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i = 1;
$found=false;
while(($i - 1) < $num){
$selection = mysql_query("SELECT ip FROM ip WHERE id=$i");
$tip = mysql_fetch_assoc($selection);
if($tip == $ip){
$found = true;
}
i++; //This is line 29
}
if($found == false){
$sql = "INSERT INTO `rowley_blog`.`ip` (`ip`) VALUES ('$ip');";
mysql_query($sql);
mysql_close();
}