- // Search in the database from the given index
- $country = i2c_search_in_db($ipn, $idx);
+ // Search in the database from the given index and if not found
+ // we attempt 3 lookups in total moving the index down one.
+ while ($country == "NA" && $count < 4) {
+ $country = i2c_search_in_db($ipnum, $idx);
+ $idx--;
+ $count++;
+ }
Note Jacques that this 'fix' you applied resulted in that no IP is properly looked up. You changed the param variable name from $ipn to $ipnum, which is the dotted representation, so no IP will be found. I'll commit a fix for this shortly, as well as some code to avoid putting php.net under a very high load for no particular reason (ie searching the db three times).
Goba