Hi,

I tried doing the import the ip2cc csv into my DB a number of times and it failed. I then tried to skip the PHP part and do the import directly through the MySQL admin interface.

CSV file from http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip
The file is also attached here

I realised that the ip2cc table has 5 fields whereas the ip-to-country.csv fields do not match the fields in the csv
That is why the import was failing.

5 fields in the DB table
Field Type
ip_from double
ip_to double
country_code char(2)
net_name varchar(128)
as_number int(11)

The first 2 records in the csv file are
"33996344","33996351","GB","GBR","UNITED KINGDOM"
"50331648","69956103","US","USA","UNITED STATES"

There needs to be an understanding of the field "as_number" which is a third numeric field in the Table. There are 3 numeric and 2 char fields in the DB whereas there are 3 char fields, 2 numeric fields in the CSV.

That may be the reason why the import is failing.

A new CSV file in sync with the DB structure is needed.

Regards,
Rahul

CommentFileSizeAuthor
ip-to-country.csv_.zip756.53 KBRahulB

Comments

mrfelton’s picture

Status: Active » Postponed (maintainer needs more info)

There is no problem with the file .cvs file. Only selected columns from it are used.

In what way is the import failing? Do you have a database table prefixes by any chance? That may have caused a problem, which I have just fixed. Please try again with the latest code in CVS, or wait for todays -dev snapshot to be created.

mrfelton’s picture

Status: Postponed (maintainer needs more info) » Fixed

This fix is now incorporated in the new release of the module I made today:
http://drupal.org/node/544270

Please uninstall ip2cc and try again with that version. If the problem persists please reopen this ticket.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.