I have been searching all over google, I found some good question here in stack overflow but they are not satisfying .
Let suppose a visitor is filling a form for selling something, I want to store his country name automatically by filtering their IP address in some kind of IP's array(correct me if i am wrong).
And when visitors land on website, I will filter their IP address
in some kind of IP's array associated with country and assign their country name is a variable. Then where ever they go there will be like :
SELECT * FROM that WHERE country = $country
I am showing my logic ! Is it possible ? If not what is the preferred way ?
Many Thanks
The above site gives us nice database, With high accuracy ! And the sample code will be like :
$sql = 'SELECT
c.country
FROM
ip2nationCountries c,
ip2nation i
WHERE
i.ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'")
AND
c.code = i.country
ORDER BY
i.ip DESC
LIMIT 0,1';
list($countryName) = mysql_fetch_row(mysql_query($sql));
// Output full country name
echo $countryName;