$ip = $_SERVER["REMOTE_ADDR"];
$country = json_encode($SxGeo->getCountry($ip));
$intoip = mysqli_query($connection, "INSERT INTO views(ip, country) VALUES('$ip', '$country')");
if(mysqli_num_rows($ip) > 1){
Что будет тут?
}
CREATE UNIQUE INDEX ip_unique_index ON ТАБЛИЦА_С_IP (ip);
INSERT INTO views(ip, country) VALUES('$ip', '$country') on duplicate key update `ip`=values('ip')