|
Posted by Ace on 08/29/05 23:13
Manually the IP is there. I am using the code as described above to
ensure I do not get a negative. here is a copy of my code, perhaps
you can see something I cant!
I am going to try and re-install the CSV file and see if that makes a
difference
<?
/*
Country SQL init code
*/
function GetCountryInfo($ip)
{
/* Include Database Params */
include "deploy-db.inc";
$ip = sprintf("%u", ip2long($ip));
$ci=array('COUNTRY_NAME' => 'Unknown', 'COUNTRY_CODE2' =>
'--', 'COUNTRY_CODE3' =>'---' , 'number' => '000','flag'
=>"NOFLAG");
$connect = mysql_connect($db_host,$db_user,$db_pass);
$select = mysql_select_db($db_name, $connect);
//$sql="SELECT IP_FROM, IP_TO, COUNTRY_CODE2, COUNTRY_CODE3,
COUNTRY_NAME FROM $country_table WHERE IP_FROM <= $ip and IP_TO
>=$ip LIMIT 0, 1;";
$sql="SELECT IP_FROM, IP_TO, COUNTRY_CODE2, COUNTRY_CODE3,
COUNTRY_NAME FROM $country_table WHERE $ip BETWEEN IP_FROM AND IP_TO
LIMIT 0, 1; ";
$query =mysql_query ($sql,$connect);
if($row = mysql_fetch_row($query))
{
$ci['COUNTRY_NAME']=$row[4];
$ci['COUNTRY_CODE2']=$row[2];
$ci['COUNTRY_CODE3']=$row[3];
$ci['flag'] = $row[2];
}
return $ci;
}
?>
Navigation:
[Reply to this message]
|