Indeed, thats what you get for coding after 2 bottles of wine
Try this instead:
PHP Code:
<?
//include config & functions from the stats
include_once("includes/config.php");
include_once("includes/functions.php");
// Query for list of ids where country = xx and player has an IP
$sql_pipcheck = "SELECT DISTINCT pid, country, ip FROM uts_player WHERE country = 'xx' AND ip > 0";
$q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error());
while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) {
$playerid = $r_pipcheck[pid];
$playerip = $r_pipcheck[ip];
// Check the players IP against the country database and update record if a country is found
$q_playercountry = small_query("SELECT country FROM uts_ip2country WHERE $playerip BETWEEN ip_from AND ip_to;");
IF($q_playercountry) {
$playercountry = strtolower($q_playercountry[country]);
mysql_query("UPDATE uts_pinfo SET country = '$playercountry' WHERE id = $playerid") or die(mysql_error());
mysql_query("UPDATE uts_player SET country = '$playercountry' WHERE pid = $playerid") or die(mysql_error());
echo "Updated Player ID $playerid to country $playercountry <br />";
}
}
?>